Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Conditional expressions (job variables)

&pagelevel(4)&pagelevel

A conditional expression is used to render the processing of commands ADD-CJC-ACTION, SKIP-COMMANDS or WAIT-EVENT dependent on job variable values. A conditional expression may be “true” or “false”. It consists of one or more relational expressions <relation.expr>, which have the following structure. Alternative expressions are separated by “/”; freely selectable specifications are enclosed in square brackets. The use of special job variables in conditional expressions is permitted only with the SKIP-COMMANDS command.

<relation.expr>

::=

(<term> <comparative-op> <term>)

<term>

::=

<jvid> / <jv-substring-def> / <const>

<comparative-op>

                                 

::=

<

/

>

/

=

/

<=

/

>=

/

<>

/

        

LT

/

GT

/

EQ

/

LE

/

GE

/

NE


<jvid>

::=

<jvname> / <*jvlink> / <#jvname> / <special-jvname>
As CJC compares at most 64 bytes, <jvid> is equivalent to specifying (<jvid>,1,64).

<jvname>

::=

Name of a permanent user job variable

<*jvlink>

::=

Link name of a user job variable with leading asterisk(*)

<#jvname>

::=

Name of a temporary user job variable

<special-jvname>

::=

Name of a special job variable without a catalog ID, but with the user ID SYSJV specified

<jv-substring-def>

::=

(<jvid> [,[<start>][,<length>]])

<start>

::=

<integer 1..256>                       

Default value = 1

<length>

::=

<integer 1..64>
(<start> + <length> <= 257)

Default value = 64

<const>

::=

<c-string 1..64> / <x-string 1..128>
for example:

C’HALLO’ or ’HALLO’ or X’00FF’ or X’0FF’


Note

If required ACS replaces the alias of a JV specified in <jv-name> by its real path name (in accordance with the alias catalog entry). 

The operators LT, GT, EQ, LE, GE and NE must be separated by a blank from constants, JV names or link names. It should be noted in particular that uppercase and lowercase letters are retained in conditional expressions. Complex conditional expressions are formed by combining relational expressions with the help of logical operators:

<cond.expr>

::=

(<relation.expr> <logical.op> <relation.expr> / <cond.expr> <logical.op> <cond.expr> / NOT <cond.expr>

<logical.op>

::=

AND

/

OR

/

XOR

                                       

logical and


logical or


exclusive or

Example

(JV1=C'START')

((JV2=C'O.K.') AND (*LINK<=C'12'))

(((JV4,10,3)=C'NEU') OR (#TEMP.JV=C'Y') AND (*LINK2=X'00'))

Note

A conditional expression is evaluated “from the lowest to the highest level” within the parentheses. At the same level within the parentheses, the logical operations are performed in the following order:

  1. NOT

  2. AND

  3. OR

  4. XOR

The following expression, for instance,

(NOT (JV1=C'ABC') OR (JV2=C'Z') AND (JV3<>JV4))

is evaluated as if it had been expressed as follows

((NOT (JV1=C'ABC')) OR ((JV2=C'Z') AND (JV3<>JV4)))

When comparing job variable values, a few special aspects have to be taken into account:

  • The evaluation of relational expressions proceeds by byte from left to right. The result of a comparison is determined by the EBCDIC bit pattern for the given values. Thus, for example, the printable digits 0 to 9 (X'F0' to X'F9') are “greater” than the letters A ... Z (X'C1' ... X'E9'), and uppercase letters are greater than lowercase letters.

  • If the comparison value lies completely outside the defined range of a job variable or the job variable is empty (e.g. after declaration), the results of comparison are “false” in every case, even if the test was for “not equal” (<>). As a result, the WAIT-EVENT command, for example, will always switch to wait state in these instances; it will then recognize if the required JV range is written and defined at a later point.

  • If the reference value lies partly inside the defined range of a JV, it’s length is reduced to the currently defined part of the JV. Example: If the job variable X contains the value C'123456', the substring (X,3,8) is evaluated as if it was (X,3,4). Therefore, the comparison (X,3,8) = C'3456' will have the result “equal”, despite the fact that a comparison between an 8 byte string and a 4 byte value may appear syntactically impossible. 

Example

The following expressions are “true”

          C' ' < C'A'
          C'a' < C'A'                      X'81' < X'C1'
          C'A' < C'B'                    X'0123' < X'0124'
          C'B' < C'BB'                     X'C1' < X'C100'
C'GUTEN ABEND' < C'GUTEN MORGEN'
  C'ZZZZZZZZZ' < C'0'       (!)      X'F0F0F0F0' < X'F1'
          C'8' < C'9'
  C'899999999' < C'9'       (!)          X'3FFF' < C' '

The response to the following queries is “false”.

(IN)     CALL-PROC PROC.JV
(IN)     /BEG-PROC LOG=*ALL
(IN)     /CRE-JV JV=JV1
(IN)     /SKIP-COMMAND TO-LABEL=END,IF=JV(COND=((JV1,11,1) NE '2')
(OUT)    %  CJC0011 SKIP-COMMANDS: CONDITION = FALSE
(IN)     /MOD-JV JV=(JV-NAME=JV1,POS=1,LENGTH=5),SET-VALUE=C'12345'
(IN)     /SKIP-COMMAND TO-LABEL=END,IF=JV(COND=((JV1,6,2) EQ 'A1')
(OUT)    %  CJC0011 SKIP-COMMANDS: CONDITION = FALSE
(IN)     /SKIP-COMMAND TO-LABEL=END,IF=JV(COND=((JV1,6,2) NE 'A1')
(OUT)    %  CJC0011 SKIP-COMMANDS: CONDITION = FALSE
(IN)     /.END END-PROC

A conditional expression will be rejected in the following cases:

  • A JV to which reference is made cannot be accessed (catalog destroyed).

  • A JV to which reference is made is not present in the specified catalog.

  • The user does not have authorization to access a password-protected or nonshareable JV.