Pragmatic directives: Difference between revisions
Content added Content deleted
(→signal on lostdigits: added a couple of clarifying words (verb tense).) |
m (→{{header|REXX}}: changed first bullet points into a "blue box".) |
||
Line 372: | Line 372: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
The REXX language has several pragmatic statements: |
The REXX language has several pragmatic statements: |
||
<big>∙</big> NUMERIC DIGITS {nnn} |
|||
<big>∙</big> NUMERIC FORM {ENGINEERING │ SCIENTIFIC} |
|||
<big>∙</big> NUMERIC FUZZ {nnn} |
|||
<big>∙</big> OPTIONS {xxx yyy zzz} |
|||
<big>∙</big> TRACE {options} |
|||
<big>∙</big> SIGNAL {ON │ OFF} LOSTDIGITS |
|||
<big>∙</big> SIGNAL {ON │ OFF} NOVALUE |
|||
<big>∙</big> SIGNAL {ON │ OFF} SYNTAX |
|||
<big>∙</big> SIGNAL │ CALL {ON │ OFF} ERROR |
|||
<big>∙</big> SIGNAL │ CALL {ON │ OFF} FAILURE |
|||
<big>∙</big> SIGNAL │ CALL {ON │ OFF} HALT |
|||
<big>∙</big> SIGNAL │ CALL {ON │ OFF} NOTREADY |
|||
===numeric digits=== |
===numeric digits=== |
||
The '''NUMERIC DIGITS nnn''' statement is used to specify |
The '''NUMERIC DIGITS nnn''' statement is used to specify to the REXX interpreter how many |
||
⚫ | |||
to the REXX interpreter how many |
|||
<br>(significant) decimal digits |
|||
⚫ | |||
'''nnn''' can be an expression that evaluates to a |
'''nnn''' can be an expression that evaluates to a positive integer. |
||
positive integer. |
|||
If '''nnn''' is omitted, it defaults to '''9'''. |
If '''nnn''' is omitted, it defaults to '''9'''. |
||
If no '''numeric digits''' statement is used, the |
If no '''numeric digits''' statement is used, the default is '''9'''. |
||
default is '''9'''. |
|||
It must be greater than the (current) '''NUMERIC FUZZ''' setting. |
It must be greater than the (current) '''NUMERIC FUZZ''' setting. |
||
===numeric fuzz=== |
===numeric fuzz=== |
||
The '''NUMERIC FUZZ nnn''' statement is used to |
The '''NUMERIC FUZZ nnn''' statement is used to specify to the REXX interpreter how many |
||
⚫ | |||
specify to the REXX interpreter how many |
|||
⚫ | |||
<br>decimal digits (at |
|||
⚫ | |||
⚫ | |||
'''nnn''' can be an expression that evaluates to a |
'''nnn''' can be an expression that evaluates to a non-negative integer. |
||
non-negative integer. |
|||
If '''nnn''' is omitted, it defaults to '''0'''. |
If '''nnn''' is omitted, it defaults to '''0'''. |
||
If no '''numeric fuzz''' statement is used, the |
If no '''numeric fuzz''' statement is used, the default for REXX programs is '''0'''. |
||
default for REXX programs is '''0'''. |
|||
It must be less than the |
It must be less than the (current) '''NUMERIC DIGITS''' setting. |
||
(current) '''NUMERIC DIGITS''' setting. |
|||
The result of using a positive value for '''FUZZ''' is |
The result of using a positive value for '''FUZZ''' is that the REXX interpreter (temporarily) reduces |
||
⚫ | |||
that the REXX interpreter (temporarily) reduces |
|||
<br>the number of '''NUMERIC DIGITS''' by |
|||
⚫ | |||
This means that arithmetic comparisons are performed with the precision of |
This means that arithmetic comparisons are performed with the precision of |
||
Line 431: | Line 420: | ||
===numeric form=== |
===numeric form=== |
||
The '''NUMERIC FORM''' statement is used to |
The '''NUMERIC FORM''' statement is used to cause the REXX interpreter to use a specific form of |
||
⚫ | |||
cause the REXX interpreter to use a specific form of |
|||
⚫ | |||
operation requires the use of exponential notation |
|||
<br>with the current value of '''numeric digits'''. |
<br>with the current value of '''numeric digits'''. |
||
Line 446: | Line 433: | ||
The option can be in upper/lower/mixed case. |
The option can be in upper/lower/mixed case. |
||
If no '''numeric form''' statement is used, the |
If no '''numeric form''' statement is used, the default for REXX programs is '''scientific'''. |
||
default for REXX programs is '''scientific'''. |
|||
===options=== |
===options=== |
||
The '''OPTIONS''' statement is used to specify |
The '''OPTIONS''' statement is used to specify to the REXX interpreter on such matters on how to |
||
⚫ | |||
to the REXX interpreter on such matters on how to |
|||
⚫ | |||
⚫ | |||
not ''double byte character strings'' |
|||
<br>are present, or possibly |
|||
⚫ | |||
<br>REXX (program) coding standards. |
<br>REXX (program) coding standards. |
||
There can be any number of options listed (or none). |
There can be any number of options listed (or none). |
||
Each particular REXX interpreters have their |
Each particular REXX interpreters have their own '''options''', so it isn't considered an error if some |
||
own '''options''', so it isn't considered an error if some |
|||
<br>option isn't supported (or recognized) by another REXX interpreter. |
<br>option isn't supported (or recognized) by another REXX interpreter. |
||
Some options are global in nature, others can be enabled and disabled. |
Some options are global in nature, others can be enabled and disabled. |
||
Some REXX interpreters also have a way to specify certain options via |
Some REXX interpreters also have a way to specify certain options via the ''command-line'' |
||
the ''command-line'' |
|||
<br>(also known as the ''C.L.''). |
<br>(also known as the ''C.L.''). |
||
===trace=== |
===trace=== |
||
The '''TRACE''' statement is used to cause the REXX |
The '''TRACE''' statement is used to cause the REXX interpreter to turn ''off'' or ''on'' certain tracing |
||
interpreter to turn ''off'' or ''on'' certain tracing |
|||
<br>facilities for the REXX interpreter. |
<br>facilities for the REXX interpreter. |
||
Most tracing options causes some sort of output (tracing of statements |
Most tracing options causes some sort of output (tracing of statements or values of clauses) to be |
||
or values of clauses) to be |
|||
<br>emitted to the console (terminal). |
<br>emitted to the console (terminal). |
||
The output (tracing information) written to the terminal is usually |
The output (tracing information) written to the terminal is usually quite distinctive and can be easily |
||
quite distinctive and can be easily |
|||
<br>recognized. |
<br>recognized. |
||
There are a number of options for |
There are a number of options for the '''trace''' instruction, and they won't be explained here. |
||
the '''trace''' instruction, and they won't be explained here. |
|||
===signal on lostdigits=== |
===signal on lostdigits=== |
||
If the REXX interpreter detects that a result of any arithmetic operation |
If the REXX interpreter detects that a result of any arithmetic operation results in the loss of any |
||
⚫ | |||
results in the loss of any |
|||
<br>decimal digits, control branches to the |
|||
⚫ | |||
Not all REXXes support this condition (option). |
Not all REXXes support this condition (option). |
||
This condition is raised when the number of significant decimal digits in |
This condition is raised when the number of significant decimal digits in the result of an arithmetic |
||
⚫ | |||
the result of an arithmetic |
|||
⚫ | |||
of digits via '''numeric digits'''. |
|||
===signal off lostdigits=== |
===signal off lostdigits=== |
||
This indicates to take the default action which is quietly ignore the |
This indicates to take the default action which is quietly ignore the condition and continue |
||
condition and continue |
|||
<br>execution of the REXX program. |
<br>execution of the REXX program. |
||
===signal on novalue=== |
===signal on novalue=== |
||
If the REXX interpreter detects an uninitialized variable is used in an |
If the REXX interpreter detects an uninitialized variable is used in an evaluated expression, control |
||
⚫ | |||
evaluated expression, control |
|||
⚫ | |||
may be in mixed case. |
|||
===signal off novalue=== |
===signal off novalue=== |
||
This indicates to take the default action which is to quietly return the value of |
This indicates to take the default action which is to quietly return the value of the uppercase version |
||
the uppercase version |
|||
<br>of the variable name and continue execution of the REXX program. |
<br>of the variable name and continue execution of the REXX program. |
||
===signal on syntax=== |
===signal on syntax=== |
||
If the REXX interpreter detects a syntax error in the REXX |
If the REXX interpreter detects a syntax error in the REXX program, (and the REXX interpreter |
||
⚫ | |||
program, (and the REXX interpreter |
|||
⚫ | |||
program), control branches |
|||
<br>to the label '''syntax'''. The label may be in mixed case. |
<br>to the label '''syntax'''. The label may be in mixed case. |
||
===signal off syntax=== |
===signal off syntax=== |
||
This indicates to take the default action which REXX issues an error message |
This indicates to take the default action which REXX issues an error message and terminates the |
||
and terminates the |
|||
<br>REXX program. |
<br>REXX program. |
||
===signal on error; call on error=== |
===signal on error; call on error=== |
||
If the REXX interpreter detects a non-zero return code from a |
If the REXX interpreter detects a non-zero return code from a host system command issued by |
||
⚫ | |||
host system command issued by |
|||
<br>the REXX program, control branches to the |
|||
⚫ | |||
===signal off error; call off error=== |
===signal off error; call off error=== |
||
This indicates to take the default action which means the special |
This indicates to take the default action which means the special variable '''RC''' ('''R'''eturn '''C'''ode) |
||
variable '''RC''' ('''R'''eturn '''C'''ode) |
|||
<br>is quietly defined, and execution continues of the REXX program. |
<br>is quietly defined, and execution continues of the REXX program. |
||
===signal on failure; call on failure=== |
===signal on failure; call on failure=== |
||
If the REXX interpreter detects a failure from a |
If the REXX interpreter detects a failure from a host system command issued by the REXX |
||
⚫ | |||
host system command issued by the REXX |
|||
<br>program, control branches to the |
|||
⚫ | |||
===signal off failure; call off failure=== |
===signal off failure; call off failure=== |
||
This indicates to take the default action which means the special |
This indicates to take the default action which means the special variable '''RC''' ('''R'''eturn '''C'''ode) |
||
variable '''RC''' ('''R'''eturn '''C'''ode) |
|||
<br>is quietly defined, and execution continues of the REXX program. |
<br>is quietly defined, and execution continues of the REXX program. |
||
===signal on halt; call on halt=== |
===signal on halt; call on halt=== |
||
If the REXX interpreter detects an external interrupt is made to |
If the REXX interpreter detects an external interrupt is made to interrupt execution of the REXX |
||
⚫ | |||
interrupt execution of the REXX |
|||
⚫ | |||
<br>program, control branches to the |
|||
⚫ | |||
⚫ | |||
is being used. |
|||
===signal off halt; call off halt=== |
===signal off halt; call off halt=== |
||
This indicates to take the default action which normally means a message is |
This indicates to take the default action which normally means a message is issued and the |
||
issued and the |
|||
<br>execution of the REXX program is terminated. |
<br>execution of the REXX program is terminated. |
||
===signal on notready; call on notready=== |
===signal on notready; call on notready=== |
||
If the REXX interpreter detects some kind of problem with stream |
If the REXX interpreter detects some kind of problem with stream I/O (this varies with each |
||
⚫ | |||
I/O (this varies with each |
|||
<br>REXX interpreter), control branches to the |
|||
⚫ | |||
===signal off notready; call off notready=== |
===signal off notready; call off notready=== |
||
This indicates to take the default action which is to quietly resume |
This indicates to take the default action which is to quietly resume execution of the REXX program. |
||
execution of the REXX program. |
|||
Not all REXXes support this condition (option). |
Not all REXXes support this condition (option). |
||
===scope=== |
===scope=== |
||
The scope for the all the above statements (except for '''options'''), if |
The scope for the all the above statements (except for '''options'''), if issued in the main program, |
||
issued in the main program, |
|||
<br>will be in effect for all internal routines (subroutines/functions/procedures). |
<br>will be in effect for all internal routines (subroutines/functions/procedures). |
||
If the above statements are issued in an internal routine, upon return from |
If the above statements are issued in an internal routine, upon return from that routine, the |
||
⚫ | |||
that routine, the |
|||
⚫ | |||
invoke of that routine). |
|||
For external routines, the defaults are used. <br><br> |
For external routines, the defaults are used. <br><br> |