Conditionally modify JV contents and branch to label
Component: | JV |
Functional area: | Job variables |
Domain: | JOB-VARIABLES |
Privileges: | STD-PROCESSING |
This function is only available to the user if the chargeable software product JV has been loaded as a subsystem.
Function
The MODIFY-JV-CONDITIONALLY command checks the contents of a JV subarea against a reference value (IF-VALUE operand). If it finds a match, it assigns the tested area a new value (SET-VALUE operand) and branches to the specified destination (LABEL operand). The value set in the event of a match may be specified directly as a character string or derived from another JV. If there is no match, the JV value remains unchanged and processing continues with the command following the MODIFY-JV-CONDITIONALLY command.
This command is permitted only in ENTER files and in procedures. In interactive mode it is rejected, and is therefore not offered as a menu option.
Note
During processing by MODIFY-JV-CONDITIONALLY (interval between comparing and modifying) the JV to be modified is protected against access by other jobs.
Format
MODIFY-JV-CONDITIONALL | Alias: MDJVC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Operands
JV-CONTENTS = <filename 1..54 without-gen-vers> / *SUBSTRING(...) / *LINK(...)
Specifies the job variable contents which are to be checked and where appropriate changed.
A JV can be identified by its name or link name.
The specified subarea is checked against the reference value specified in the IF-VALUE operand. If there is a match, the tested area is changed to the value specified in the SET-VALUE operand. If there is no match, the JV contents remain unchanged.
JV-CONTENTS = <filename 1..54 without-gen-vers>
Name of the JV. Such entry is an abbreviation of JV-CONTENTS=*SUBSTRING(<jv-name>, 1, *REST)
JV-CONTENTS = *SUBSTRING(...)
The contents of the subarea identified by POSITION and LENGTH are checked and where appropriate changed.
JV-NAME = <filename 1..54 without-gen-vers>
Name of the JV.
POSITION = 1 / <integer 1..256>
Position within the JV at which checking and where appropriate changing is to begin.
LENGTH = *REST / <integer 1..256>
Number of characters to be checked and where appropriate changed.
The sum of the numeric values specified in the POSITION and LENGTH operands must not exceed 257.
LENGTH = *REST
For the comparison, the length of the reference value applies; for the modification, the length of the JV value starting from the position specified in the POSITION operand up to position 256. If the value to be transferred is shorter, no blanks are appended but instead the area following is (again) undefined.
JV-CONTENTS = *LINK(...)
The JV is identified by its link name. If POSITION and LENGTH are not specified, the contents of the entire JV are checked and, if necessary, modified; if they are, the contents of the specified subarea are modified.
LINK-NAME = <alphanum-name 1..7>
Link name of the JV.
POSITION = 1 / <integer 1..256>
Position within the JV at which checking and where appropriate changing is to begin.
LENGTH = *REST / <integer 1..256>
Number of characters to be checked and where appropriate changed. The sum of the numeric values specified in the POSITION and LENGTH operands must not exceed 257.
LENGTH = *REST
For the comparison, the length of the reference value applies; for the modification, the length of the JV value starting from the position specified in the POSITION operand up to position 256. If the value to be transferred is shorter, no blanks are appended but instead the area following is (again) undefined.
IF-VALUE = <c-string 1..254 with-low> / <x-string 1..508>
Reference value against which the JV contents specified in the JV-CONTENTS operand are to be checked. The reference value must be specified as a string (<c-string> or <xstring>); in the case of a C string the uppercase/lowercase distinction is significant. If the comparison value is longer than the number of characters to be compared, it is truncated; if it is shorter, it is padded with blanks.
SET-VALUE = <c-string 1..254 with-low> / <x-string 1..508> / <filename 1..54 without-gen-vers> / *LINK(...)
New value that the JV contents specified in the JV-CONTENTS operand will be given if the existing value matches the reference value (IF-VALUE). The value to be set may be
specified directly as a character string (<c-string> or <x-string>); C strings are case-sensitive
derived from a JV identified by name or link name.
If the value to be transferred is longer than the number of characters to be set, it is truncated; if it is shorter, it is padded with blanks.
The command is rejected if
the JV specified does not exist
the JV specified is not set (has no value)
there is no access right for the specified JV.
SET-VALUE = <filename 1..54 without-gen-vers>
Name of the JV. The entire contents of this JV are taken as the new value.
SET-VALUE = *LINK(...)
The contents of a JV identified by its link name are taken as the new value.
LINK-NAME = <alphanum-name 1..7>
Link name of the JV.
LABEL = *NONE / <name 1..8>
(Non-S) label that identifies the command line (branch destination) at which processing is to be continued if the current JV value matches the reference value (IF-VALUE). If there is no match, processing continues with the next command. The default value is *NONE, i.e. processing resumes with the next command. In this case, the command result (condition satisfied or not satisfied) in S procedures or dialog blocks can be derived from the command return code. For evaluation purposes, the next command must be SAVE-RETURNCODE since no error condition is present.
PASSWORD = *NONE / <c-string 1..4> / <x-string 1..8> / <integer -2147483648..2147483647> / *SECRET
Write or read password for the JV to be modified. The PASSWORD operand has the following special characteristics:
The input field is automatically blanked out in the guided dialog.
In unguided dialog and foreground procedures, the entry *SECRET or ^, SDF provides a blanked out input field for inputting the password.
The password entered is not logged.
Return codes
(SC2) | SC1 | Maincode | Meaning |
---|---|---|---|
0 | CMD0001 | Command executed because condition was satisfied | |
1 | 0 | CMD0001 | No action necessary as condition was not satisfied |
2 | 0 | CMD0001 | Command executed with a warning |
1 | CMD0202 | Syntax error | |
32 | CMD0221 | System error | |
64 | JVS04E0 | Command not executable in the call environment; if possible, remove cause of error (see SYSOUT message JVS04xx) | |
130 | JVS04E1 | Command cannot be executed at this time; for cause see SYSOUT message JVS04xx | |
130 | CMD2282 | Subsystem JV not available for indefinite time |
Note
Other than the ADD-CJC-ACTION, SKIP-COMMANDS and WAIT-EVENT commands, the MODIFY-JV-CONDITIONALLY command does not work with real conditional expressions. As a consequence, the result of the comparison will deviate in the following cases:
If the JV range specified in the JV-CONTENTS operand is fully undefined, the command is rejected.
If a JV substring is specified that is longer than the defined range, the comparison will still be performed with the specified length. Since it is not possible to specify unspecified characters in the IF-VALUE reference value, the result of the comparison is always “not equal”.
Example
...... ...... /.RESRV MOD-JV-COND JV=*LINK(LOCK,8,4),IF-VAL='FREE',- / SET-VAL=$SYSJV.TSN,LABEL=RESRVD —————————————————— (1) / WAIT-EVENT UNTIL=*JV(TIME-LIMIT=10,TIMEOUT-LABEL=RESRV)—————— (2) /.RESRVD REMARK 'Belegung erfolgreich' ...... ......
(1) | In bytes 8 -11 of the job variable identified by the link name LOCK the TSN of the user’s own task is entered, provided the old contents have the value ’FREE’. In this case, command processing is resumed at the label RESRVD. |
(2) | If the contents are checked and found not to be equal to the value ’FREE’, the MODIFY-JV-CONDITIONALLY command is called again after a wait time of 10 seconds. |