Previous Topic: SyntaxNext Topic: SYNCKEY


Parameters

STOP supports the following parameters:

CLOSE

This parameter value closes the INFILE when the STOP keyword is processed. This is the default value, but it may have been changed during installation.

Note: If the INFILE keyword is present, and CLOSE/NOCLOSE is not specified with the STOP keyword, STOP sets its CLOSE/NOCLOSE option to that of the INFILE.

NOCLOSE

This parameter value does not close the INFILE when the STOP keyword is processed. However, all data sets are closed before executing subsequent job steps.

When the NOCLOSE parameter is used, the current job step's subsequent command begins processing with the record that matched the STOP selection criteria.

Example 1

This example stops command processing when invalid packed data is found in the CUST-BALANCE field. Once detected, the record is printed using the layout file referenced by ddname LAYOUT, the condition code is set to 8, and the command stops. The record on which the invalid packed data was found is available to any subsequent commands within the particular job step.

PRINT,
  LAYOUTFILE(LAYOUT),
  FORMAT(S),  
  SELRECIF(CUST-BALANCE,NEP),
     SETRC(8),
	STOP(NOCLOSE)

Example 2

In this example when a C'400' is found for field CUST-REWARD-LEVEL, the record is written to the file referenced by the ddname REC400, and the READ command is immediately terminated. For all other records that do not meet this selection, they are written to the file referenced by ddname OLDRECS. (Usually the action previous to an IF statement ends the previous IF's actions, in this case WRITE(OLDRECS). However, when STOP is used, it ends the subordinate actions to the previous IF/AND/OR.) Any records with a CUST-REWARD-LEVEL of C'500' are written to the file referenced to by REC500.

READ,
  MOVE(CLEAR),
  MOVE(1,0,1),
  IF(CUST-REWARD-LEVEL,EQ,C'400'),
	WRITE(REC400),
	STOP,
  WRITE(OLDRECS),
  IF(CUST-REWARD-LEVEL,EQ,C'500),
	WRITE(REC500)