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:
::*   NUMERIC DIGITS   {nnn}
<big>∙</big> &nbsp; NUMERIC DIGITS &nbsp; {nnn}
::* &nbsp; NUMERIC FORM &nbsp; &nbsp; {ENGINEERING │ SCIENTIFIC}
<big>∙</big> &nbsp; NUMERIC FORM &nbsp; &nbsp; {ENGINEERING │ SCIENTIFIC}
::* &nbsp; NUMERIC FUZZ &nbsp; &nbsp; &nbsp; {nnn}
<big>∙</big> &nbsp; NUMERIC FUZZ &nbsp; &nbsp; {nnn}
::* &nbsp; OPTIONS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {xxx yyy zzz}
<big>∙</big> &nbsp; OPTIONS &nbsp; &nbsp; &nbsp; &nbsp; {xxx yyy zzz}
::* &nbsp; TRACE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {options}
<big>∙</big> &nbsp; TRACE &nbsp; &nbsp; &nbsp; &nbsp; {options}
::* &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; LOSTDIGITS
<big>∙</big> &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; {ON │ OFF} &nbsp; LOSTDIGITS
::* &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; NOVALUE
<big>∙</big> &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; {ON │ OFF} &nbsp; NOVALUE
::* &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; SYNTAX
<big>∙</big> &nbsp; SIGNAL &nbsp; &nbsp; &nbsp; &nbsp; {ON │ OFF} &nbsp; SYNTAX
::* &nbsp; SIGNAL│CALL &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; ERROR
<big>∙</big> &nbsp; SIGNAL │ CALL &nbsp; {ON OFF} &nbsp; ERROR
::* &nbsp; SIGNAL│CALL &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; FAILURE
<big>∙</big> &nbsp; SIGNAL │ CALL &nbsp; {ON OFF} &nbsp; FAILURE
::* &nbsp; SIGNAL│CALL &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; HALT
<big>∙</big> &nbsp; SIGNAL │ CALL &nbsp; {ON OFF} &nbsp; HALT
::* &nbsp; SIGNAL│CALL &nbsp; &nbsp; &nbsp; {ON│OFF} &nbsp; NOTREADY
<big>∙</big> &nbsp; SIGNAL │ CALL &nbsp; {ON OFF} &nbsp; NOTREADY


===numeric digits===
===numeric digits===
The &nbsp; '''NUMERIC DIGITS nnn''' &nbsp; statement is used to specify
The &nbsp; '''NUMERIC DIGITS nnn''' &nbsp; statement is used to specify to the REXX interpreter how many
<br>(significant) decimal digits are to be used in calculating and storing numbers.
to the REXX interpreter how many
<br>(significant) decimal digits
are to be used in calculating and storing numbers.


'''nnn''' &nbsp; can be an expression that evaluates to a
'''nnn''' &nbsp; can be an expression that evaluates to a positive integer.
positive integer.


If &nbsp; '''nnn''' &nbsp; is omitted, it defaults to &nbsp; '''9'''.
If &nbsp; '''nnn''' &nbsp; is omitted, it defaults to &nbsp; '''9'''.


If no &nbsp; '''numeric digits''' &nbsp; statement is used, &nbsp; the
If no &nbsp; '''numeric digits''' &nbsp; statement is used, &nbsp; the default is &nbsp; '''9'''.
default is &nbsp; '''9'''.


It must be greater than the (current) &nbsp; '''NUMERIC FUZZ''' &nbsp; setting.
It must be greater than the (current) &nbsp; '''NUMERIC FUZZ''' &nbsp; setting.


===numeric fuzz===
===numeric fuzz===
The &nbsp; '''NUMERIC FUZZ nnn''' &nbsp; statement is used to
The &nbsp; '''NUMERIC FUZZ nnn''' &nbsp; statement is used to specify to the REXX interpreter how many
<br>decimal digits &nbsp; (at full precision) &nbsp; will be ignored while performing an arithmetic
specify to the REXX interpreter how many
<br>comparison.
<br>decimal digits &nbsp; (at
full precision) &nbsp; will be ignored while performing an arithmetic
<br>comparison.


'''nnn''' &nbsp; can be an expression that evaluates to a
'''nnn''' &nbsp; can be an expression that evaluates to a non-negative integer.
non-negative integer.


If &nbsp; '''nnn''' &nbsp; is omitted, &nbsp; it defaults to &nbsp; '''0'''.
If &nbsp; '''nnn''' &nbsp; is omitted, &nbsp; it defaults to &nbsp; '''0'''.


If no &nbsp; '''numeric fuzz''' &nbsp; statement is used, &nbsp; the
If no &nbsp; '''numeric fuzz''' &nbsp; statement is used, &nbsp; the default for REXX programs is &nbsp; '''0'''.
default for REXX programs is &nbsp; '''0'''.


It must be less than the
It must be less than the (current) &nbsp; '''NUMERIC DIGITS''' &nbsp; setting.
(current) &nbsp; '''NUMERIC DIGITS''' &nbsp; setting.


The result of using a positive value for &nbsp; '''FUZZ''' &nbsp; is
The result of using a positive value for &nbsp; '''FUZZ''' &nbsp; is that the REXX interpreter (temporarily) reduces
<br>the number of &nbsp; '''NUMERIC DIGITS''' &nbsp; by the &nbsp; '''FUZZ''' &nbsp; value before an arithmetic comparison.
that the REXX interpreter (temporarily) reduces
<br>the number of &nbsp; '''NUMERIC DIGITS''' &nbsp; by
the &nbsp; '''FUZZ''' &nbsp; value before an arithmetic comparison.


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 &nbsp; '''NUMERIC FORM''' &nbsp; statement is used to
The &nbsp; '''NUMERIC FORM''' &nbsp; statement is used to cause the REXX interpreter to use a specific form of
<br>exponential format &nbsp; if &nbsp; the result of an arithmetic operation requires the use of exponential notation
cause the REXX interpreter to use a specific form of
<br>exponential format &nbsp; if &nbsp; the result of an arithmetic
operation requires the use of exponential notation
<br>with the current value of &nbsp; '''numeric digits'''.
<br>with the current value of &nbsp; '''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 &nbsp; '''numeric form''' &nbsp; statement is used, &nbsp; the
If no &nbsp; '''numeric form''' &nbsp; statement is used, &nbsp; the default for REXX programs is &nbsp; '''scientific'''.
default for REXX programs is &nbsp; '''scientific'''.


===options===
===options===
The &nbsp; '''OPTIONS''' &nbsp; statement is used to specify
The &nbsp; '''OPTIONS''' &nbsp; statement is used to specify to the REXX interpreter on such matters on how to
<br>process the source (statements), possibly (for instance) whether or not &nbsp; ''double byte character strings'' &nbsp;
to the REXX interpreter on such matters on how to
<br>are present, or possibly cause the REXX interpreter to force compliance to some particular rule or
<br>process the source (statements), possibly (for instance) whether or
not &nbsp; ''double byte character strings'' &nbsp;
<br>are present, or possibly
cause the REXX interpreter to force compliance to some particular rule or
<br>REXX (program) coding standards.
<br>REXX (program) coding standards.


There can be any number of options listed &nbsp; (or none).
There can be any number of options listed &nbsp; (or none).


Each particular REXX interpreters have their
Each particular REXX interpreters have their own &nbsp; '''options''', &nbsp; so it isn't considered an error if some
own &nbsp; '''options''', &nbsp; 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 &nbsp; ''command-line'' &nbsp;
the &nbsp; ''command-line'' &nbsp;
<br>(also known as the &nbsp; ''C.L.'').
<br>(also known as the &nbsp; ''C.L.'').


===trace===
===trace===
The &nbsp; '''TRACE''' &nbsp; statement is used to cause the REXX
The &nbsp; '''TRACE''' &nbsp; statement is used to cause the REXX interpreter to turn &nbsp; ''off'' &nbsp; or ''on'' &nbsp; certain tracing
interpreter to turn &nbsp; ''off'' &nbsp; or ''on'' &nbsp; certain tracing
<br>facilities for the REXX interpreter.
<br>facilities for the REXX interpreter.


Most tracing options causes some sort of output &nbsp; (tracing of statements
Most tracing options causes some sort of output &nbsp; (tracing of statements or values of clauses) &nbsp; to be
or values of clauses) &nbsp; 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 &nbsp; '''trace''' &nbsp; instruction, and they won't be explained here.
the &nbsp; '''trace''' &nbsp; 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
<br>decimal digits, &nbsp; control branches to the label &nbsp; &nbsp; '''lostdigits'''. &nbsp; The label may be in mixed case.
results in the loss of any
<br>decimal digits, &nbsp; control branches to the
label &nbsp; &nbsp; '''lostdigits'''. &nbsp; The label may be in mixed case.


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
<br>operation that would exceed the currently defined number of digits via &nbsp; '''numeric digits'''.
the result of an arithmetic
<br>operation that would exceed the currently defined number
of digits via &nbsp; '''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, &nbsp; control
<br>branches to the label &nbsp; &nbsp; '''novalue'''. &nbsp; The label may be in mixed case.
evaluated expression, &nbsp; control
<br>branches to the label &nbsp; &nbsp; '''novalue'''. &nbsp; The label
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 &nbsp; syntax &nbsp; error in the REXX
If the REXX interpreter detects a &nbsp; syntax &nbsp; error in the REXX program, &nbsp; (and the REXX interpreter
<br>determines that the error can still be handled by the erroneous REXX program), &nbsp; control branches
program, &nbsp; (and the REXX interpreter
<br>determines that the error can still be handled by the erroneous REXX
program), &nbsp; control branches
<br>to the label &nbsp; &nbsp; '''syntax'''. &nbsp; The label may be in mixed case.
<br>to the label &nbsp; &nbsp; '''syntax'''. &nbsp; 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 &nbsp; non-zero &nbsp; return code from a
If the REXX interpreter detects a &nbsp; non-zero &nbsp; return code from a host system command issued by
<br>the REXX program, &nbsp; control branches to the label &nbsp; &nbsp; '''error'''. &nbsp; The label may be in mixed case.
host system command issued by
<br>the REXX program, &nbsp; control branches to the
label &nbsp; &nbsp; '''error'''. &nbsp; The label may be in mixed case.


===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 &nbsp; '''RC''' &nbsp; ('''R'''eturn '''C'''ode) &nbsp;
variable &nbsp; '''RC''' &nbsp; ('''R'''eturn '''C'''ode) &nbsp;
<br>is quietly defined, &nbsp; and execution continues of the REXX program.
<br>is quietly defined, &nbsp; 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 &nbsp; failure &nbsp; from a
If the REXX interpreter detects a &nbsp; failure &nbsp; from a host system command issued by the REXX
<br>program, &nbsp; control branches to the label &nbsp; &nbsp; '''failure'''. &nbsp; The label may be in mixed case.
host system command issued by the REXX
<br>program, &nbsp; control branches to the
label &nbsp; &nbsp; '''failure'''. &nbsp; The label may be in mixed case.


===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 &nbsp; '''RC''' &nbsp; ('''R'''eturn '''C'''ode) &nbsp;
variable &nbsp; '''RC''' &nbsp; ('''R'''eturn '''C'''ode) &nbsp;
<br>is quietly defined, &nbsp; and execution continues of the REXX program.
<br>is quietly defined, &nbsp; 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 &nbsp; external interrupt &nbsp; is made to
If the REXX interpreter detects an &nbsp; external interrupt &nbsp; is made to interrupt execution of the REXX
<br>program, &nbsp; control branches to the label &nbsp; &nbsp; '''halt'''. &nbsp; The label may be in mixed case.
interrupt execution of the REXX
<br>The &nbsp; ''external interrupt'' &nbsp; varies with which operating system is being used.
<br>program, &nbsp; control branches to the
label &nbsp; &nbsp; '''halt'''. &nbsp; The label may be in mixed case.
<br>The &nbsp; ''external interrupt'' &nbsp; varies with which operating system
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 &nbsp; (this varies with each
<br>REXX interpreter), &nbsp; control branches to the label &nbsp; &nbsp; '''notready'''. &nbsp; The label may be in mixed case.
I/O &nbsp; (this varies with each
<br>REXX interpreter), &nbsp; control branches to the
label &nbsp; &nbsp; '''notready'''. &nbsp; The label may be in mixed case.


===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 &nbsp; (except for '''options'''), &nbsp; if
The scope for the all the above statements &nbsp; (except for '''options'''), &nbsp; 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, &nbsp; the
<br>original status is restored &nbsp; (to just before the invoke of that routine).
that routine, &nbsp; the
<br>original status is restore &nbsp; (to just before the
invoke of that routine).


For external routines, the defaults are used. <br><br>
For external routines, the defaults are used. <br><br>