Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Expressions

&pagelevel(6)&pagelevel

An expression defines how a new value is calculated from existing values. An expression is created by linking base terms with operators. Base terms can be:

  • <c-string>

  • <x-string>

  • Boolean constants with ON, TRUE, YES for Boolean one and with OFF, FALSE, NO for Boolean zero

  • the name of an S variable

  • the function call of a builtin function

Depending on what operators are used, a distinction is made between:

  • string expressions

  • arithmetic expressions

  • comparison expressions

  • logical expressions

Only comparison expressions and logical expressions (negation only) are possible with SDF-P-BASYS. The other expressions are described in the “SDF-P” manual [34].

Comparison expressions have the format:

( expression1 operator expression2 )

expression 1 or expression 2 can be any expressions (base term or a permissible expression), but they must be of the same type. If they are not, an error message is issued and SDF-P error recovery is triggered.

The following operators are possible:

LT

or

<

less than

LE

or

<=

less than or equal to

EQ

or

=     or     ==

equal to

NE

or

<>

not equal to

GT

or

>

greater than

GE

or

>=

greater than or equal to

The complete expression must be enclosed in parentheses. Operators must be enclosed in blanks.

The result of a comparison is of the type BOOLEAN, i.e. it is either TRUE or FALSE.

Strings are compared byte by byte and from left to right. The comparison is based on the position of the characters in EBCDIC code. The result is determined by the first non-match. No further characters are compared after that. If no differences are detected up to the final character in the shorter of the operands, the longer operand is larger. Operands are equal if all of their characters match up.

Example

A = ’ABC’          

       

B = ’ABCDE’



(B > A)

->

result TRUE

(’A’ = X’C1’)

->

result TRUE

(B > ’1’)

->

result FALSE

C = (A = B)

->

variable C has FALSE

A logical operator links expressions of the type BOOLEAN. Only the logical operator NOT is available with SDF-P-BASYS; this returns the negation of an expression as the result:

NOT( expression 1 )

Example

A = ’AB’           

       

B = ’ABCD’



(B > A)

->

result TRUE

NOT(B > A)

->

result FALSE

Note

The term “string expression”, which is used as a parameter in builtin functions, can have the following values:

  • a string enclosed in apostrophes (<c-string>)

  • the name of a variable containing a string (<composed-name>)

  • an expression returning a string as the result

Example

/JV-NAME = ’MY-JV’

           


/MY-VAR = JV(’JV-NAME’)

->

Value of the job variable JV-NAME

/MY-VAR = JV(JV-NAME)

->

Value of the job variable MY-JV

/MY-VAR = JV(’&JV-NAME’)

->

Value of the job variable MY-JV

/MY-VAR = JV(JV(JV-NAME))

->

Value of the job variable whose name is stored in the job variable MY-JV