Previous Topic: ParametersNext Topic: Example 1


Keywords

The following is a complete list of the valid keywords that you can use with the IF, AND, OR keywords.

The following table shows examples of conditional processing.

Example

Description

IF(1,GT,C'123')

Position 1 > '123'

IF(1,EQ,C'12',C'234',C'5')

Position 1 = '12' or '234' or '5'

IF(1,NE,C'A',C'B')

Position 1 not = either literal

IF(1,1,NE,C'A',C'B')

Position 1 not = either literal

IF(1,5,NE,C'A',C'B')

Neither literal found in scan of position1 - 5

IF(1,EQ,C'ABCD',T'Efg')

Comparison against mixed format of character string

IF(1,20,EQ,C'ABC')

Scan for 'ABC' starting in position 1 for a length of 20

IF(1,20,GT,C'123')

Scan for any 3-byte character string > '123' in position 1-20

IF(1,0,EQ,C'ABC')

Scan for 'ABC' starting in position 1 to end of record

IF(1,EQ,C'A')

Position 1 = 'A'

IF(1,EQ,T'ABC,DEFG,HIJKL')

Literals within single quotes compared to position 1

IF(1,50,EQ,C"2,000,000.00")

Literal containing ',' within double quotes

IF(1,EQ,C'AA,BB,CC')

Position 1= 'AA' or 'BB' or 'CC'

IF(1,50,EQ,C'ABC',P'00001',T'Abc')

Scan for any of these character strings in position 1 for a length of 50

IF(21,0,EQ,C'ABC',P'00001',T'Def')

Scan for any of these character strings in position 21 to the end of the record

IF(1,0,EQ,P'0001')

Packed field of any length with value of 1 starting in position 1

IF(1,3,GT,P'00001')

Compare of position 1 for a length of 3 to packed 3-byte literal

IF(1,5,EQ,P'00001')

Scan of position 1 for a length of 5 for packed 3-byte literal

IF(1,5,LT,C' ')

Compare position 1 for a length of 5 to < blanks

IF(1,5,LT,3C' ')

Scan position 1 for a length of 5 for 3 positions < blanks

IF(20,0,EQP)

Packed field of any length starting in position 20

IF(20,3,EQP)

Packed field of length 3 at position 20

IF(20,4,NEP)

Position 20 for a length of 4 is not a valid packed field

IF(20,0,NEP)

The field starting at position 20 is not a valid packed field

IF(20,0,5NEP)

Not true that there are 5 contiguous packed fields of any length starting in position 20

IF(20,3,10EQP)

Ten 3-byte packed fields starting in position 20

IF(20,3,10EQP)

Not true that there are ten 3-byte packed fields starting in position 20

IF(20,0,EQP)

Packed field of any length starting in position 20

IF(10,5,EQN)

10 (5) is valid numeric

IF(10,5,3EQN)

Three consecutive 5-byte numeric fields starting in position 10