EVALOPT parameter: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
<dd>0
<dd>0
<dt>Maximum value
<dt>Maximum value
<dd>1
<dd>7
<dt>Parameter type
<dt>Parameter type
<dd>User
<dd>User
Line 12: Line 12:
<dd>Any user
<dd>Any user
<dt>Introduced
<dt>Introduced
<dd>V7.8  
<dd>V7.8 (Options 2 & 4 added in 79)
</dl>
</dl>


==Description==
==Description==
Controls the cancellation of a request on truncation of string data.
The user parameter <var>EVALOPT</var> allows optional modifications to evaluation behaviors. The bits in <var>EVALOPT</var> have the following meanings:
Currently there is just one setting, 1, which means "cancel a request if truncation of string data occurs."
For example, with the default of 0 in place, the following code <p class="code">   %x is string len 1 
    %y is string len 2 
    %y = 'ab'           
    %x = %y             
    printtext {~} = {%x} </p>
 
would cause silent truncation, and give the result
    <p class="code">%x = a </p>
 
If <var>EVALOPT</var> is set to 1, then the above code produces the following message:
    <p class="code">M204.0552: Variable too small for result </p>
 
and the request is cancelled.


<table class="thJustBold">
<tr><th>X'01'</th>
<td>If on, the evaluating request will be cancelled on truncation of a data string. </td></tr>
<tr><th>X'02'</th>
<td>If on, the evaluating request will be cancelled on a non-convertable number. </td></tr>
<tr><th>X'04'</th>
<td>If on, nulls will be considered as non-convertable numbers. </td></tr>
</table>
<p>
For example, consider the following code:
<p class="code">%v is string len 2 initial('ST')
%s is string len 1   
%f is float           
%n is float           
%s = %v               
%f = %v               
%n = ''               
printtext {~} = {%s} 
printtext {~} = {%f} 
printtext {~} = {%n}  </p>
If <var>EVALOPT</var> is set to 0 (default), then the above code would allow silent truncation and give the result:
<p class="code">%s = S 
%f = 0 
%n = 0    </p>
If <var>EVALOPT</var> is set to 1 , then the above code is cancelled with the following message:
    <p class="code">M204.0552: Variable too small for result </p>
If <var>EVALOPT</var> is set to 2 or 4 , then the above code is cancelled with the following message:
    <p class="code">M204.2985: Invalid numeric conversion </p>


[[Category:Parameters]]
[[Category:Parameters]]

Revision as of 21:08, 7 February 2023

Evaluation options

Summary

Default value
0
Maximum value
7
Parameter type
User
Where set
Any user
Introduced
V7.8 (Options 2 & 4 added in 79)

Description

The user parameter EVALOPT allows optional modifications to evaluation behaviors. The bits in EVALOPT have the following meanings:

X'01' If on, the evaluating request will be cancelled on truncation of a data string.
X'02' If on, the evaluating request will be cancelled on a non-convertable number.
X'04' If on, nulls will be considered as non-convertable numbers.

For example, consider the following code:

%v is string len 2 initial('ST') %s is string len 1 %f is float %n is float %s = %v %f = %v %n = printtext {~} = {%s} printtext {~} = {%f} printtext {~} = {%n}

If EVALOPT is set to 0 (default), then the above code would allow silent truncation and give the result:

%s = S %f = 0 %n = 0

If EVALOPT is set to 1 , then the above code is cancelled with the following message:

M204.0552: Variable too small for result

If EVALOPT is set to 2 or 4 , then the above code is cancelled with the following message:

M204.2985: Invalid numeric conversion