Joel
It actually works with non-numerics - as long as the value is a valid return code. You can try with U0000, U0004 and U0008 instead of A, B and C.

Birger Heede
IBM DK


Joel C. Ewing wrote:
More explicitly, the JCL reference manual states:
"Use comparison operators in a relational-expression to compare a
keyword with a numeric value."

This doesn't directly address the special case where two numeric values
(after substitution)  are being compared - in fact nowhere is it stated
that comparison of two values where neither is a keyword is a legal
syntax, although we know from empirical evidence it works with two
numerics.

The manual does imply rather strongly that the JCL IF/THEN/ELSE
relational operators work with numeric values only, not character
strings; and this interpretation is re-enforced by the lack of a syntax
for defining a character string constant.

Since string constants are not supported for these statements, the JCL
interpreter would attempt to parse "A", "B", or "C" operands to a
relational operator as a keyword and fail.  So Birger is technically
correct in referring to this as an unacceptable "keyword", although this
explanation is confusing since the user obviously intended these to be
interpreted as string constants.

The inclusion of the always-true "STEPNULL.RC= 0 AND" portion of the
statements is irrelevant as to whether the statement is acceptable.
  JC Ewing

On 11/07/2009 08:28 AM, Birger Heede wrote:
You cannot use just any 'keyword' in the IF statement. See the JCL
Referece manual for relation-expression keywords for the IF statement.
z/OS 1.11 library is here:
http://publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp

The example that works use valid return code values (0-4095) and
therefore is seen as a value rather a symbol (I think).

Birger Heede
IBM DK



Dibitu wrote:
Why this is OK
//SETV SET VERSION=8
//STEPNULL EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//IF1 IF STEPNULL.RC= 0 AND &VERSION=7 THEN
//VERSION7 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF
//IF1 IF STEPNULL.RC= 0 AND &VERSION=8 THEN
//VERSION8 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF
//IF1 IF STEPNULL.RC= 0 AND &VERSION=9 THEN
//VERSION9 EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF

and this is JCL ERROR ?

//SETV SET VERSION=B
//STEPNULL EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//IF1 IF STEPNULL.RC= 0 AND &VERSION=A THEN
//VERSIONA EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF
//IF1 IF STEPNULL.RC= 0 AND &VERSION=B THEN
//VERSIONB EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF
//IF1 IF STEPNULL.RC= 0 AND &VERSION=C THEN
//VERSIONC EXEC PGM=IEFBR14
//SYSPRINT DD  SYSOUT=*
//ENDIF1 ENDIF

STMT NO. MESSAGE
       5 IEFC013I ERROR IN IF STATEMENT: B NOT VALID
       9 IEFC013I ERROR IN IF STATEMENT: B NOT VALID
      13 IEFC013I ERROR IN IF STATEMENT: B NOT
VALID




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to