# jCL IF E

Updated: 10/19/2020, 10:24:56 AM
Created: 10/19/2020, 10:24:56 AM
Last Updated By: Daniel Klein
Read Time: 2 minute(s)

Tags: jcl

# Description

This command conditionally executes a command depending on the presence or absence of an error message after running a shell command. It takes the general form:

IF {#} E command


IF E operator msg-key command


  • tests for the absence of an error message.
  • operator performs a value comparison. Operators are:
    • =   Equal to
    • # Not equal to.
  • msg-key is the key of a system message from the error file.
  • command is a valid jCL  command.

# Note

Any system messages generated as a result of running a shell command (see the P command) will cause the system message number to be placed in the SIB, in multivalue format. The value tested is the first multivalue (the STOP  code) of the error text returned from the last command. The IF E command is most often used to test for an error condition but can be used to detect any resulting system message. IF # E command tests for the absence of a system message.

Some jCL  commands, particularly those that operate on the PIB, will destroy the contents of the secondary input buffer. You should therefore use the IF E command as soon as control returns from the shell command.

# Example

022 PH
023 IF E = 401 G 100

If the SALES file does not contain any records, which match the criteria, the system will generate the message "No records counted". Using the PH command will stop the message being output on the terminal but the message key 401 will still be placed in the SIB where it can be detected by line 23.

Back to jCL.