Previous Topic: Format of ENDIF StatementNext Topic: Comments


Logic Examples

Example 1

Example 1 shows a Logic Control Statement (1) directing the steps CA‑PanAPT needs to execute based on a condition of ABCDE.

@  IF $MSG    = 'ABCDE'                 (1)
 //STEP1 DD DISP=SHR,DSN=SYS1.LOADLIB    (2)
 @  ELSE                                 (3)
 //STEP2 DD DISP=SHR,DSN=SYS2.LOADLIB    (4)
 @  ENDIF                                (5)

(1) This is a Model Control Statement because it has an @ in Column 1. It is also a Logic Control Statement that is testing the value of the system keyword $MSG because of the IF statement.

(2) This is a Data Statement (no @ in Column 1). This Data Statement is generated (written to the output file) as an output statement only if the IF statement in (1) is true. If the IF statement is false, this Data Statement is not included in the output.

(3) This is a Model Control Statement because it has an @ in Column 1. It is also a Logic Control Statement because of the ELSE statement. The ELSE corresponds to the preceding IF. The ELSE statement is always optional.

(4) This is a Data Statement (no @ in Column 1). This Data Statement is generated as an output statement only if the IF statement in (1) is false. If the IF statement in (1) is true, this Data Statement is not included in the output.

(5) This is a Model Control Statement because it has an @ in Column 1. It is also a Logic Control Statement because of the ENDIF statement. It is the ENDIF that corresponds to the preceding IF.

The ENDIF statement is required. If this model omitted the ENDIF statement, a Model Processing Error would occur.

Example 2

Example 2 shows how to set the value of a system keyword.

The following statement is invalid:

@ IF <$MSG,1,1> = 'A'

$MSG is a system keyword, but <$MSG,1,1> is not. Therefore, CA‑PanAPT rejects the statement. You can express the test correctly with the following two statements:

@ MSG1 = '<$MSG,1,1>'
@ IF MSG1 = 'A'