Yeah, IF is EXEC COND in a different suit of clothes. It must control an entire jobstep. :-(
Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Nash, Jonathan S. Sent: Thursday, January 6, 2022 8:30 PM To: [email protected] Subject: JCL IF-THEN-ELSE-ENDIF Re: ... Re: Top 8 Reasons for using Python instead of REXX for z/OS Its funny you should mention that now. I was just working on some JCL and I had just assumed that I could set symbolics using IF THEN ELSE ENDIF: // IF (STEP1.RC = 0) THEN // SYMB=GOOD // ELSE // SYMB=BAD // ENDIF but I found out that BOTH SET statements are executed no matter what the return code is . It also appears to me that I cannot put just one DD within an IF statement. It looks an entire step has to be in there... I think... too bad... It would be nice the other way... -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Andrew Rowley Sent: Thursday, January 06, 2022 10:06 PM To: [email protected] Subject: [EXTERNAL] Re: ... Re: Top 8 Reasons for using Python instead of REXX for z/OS On 7/01/2022 12:23 pm, David Crayford wrote: > > I understand that it's declarative. But it has logic such as IF/THEN. > That is no reason why it couldn't have been a scripting language like > CL on AS/400. > IF/THEN was a late addition, and is probably one of the biggest problems with JCL because it doesn't work like IF/THEN in a programming language. IF/THEN is really a property of the enclosed steps (I suspect it generates the same thing as equivalent COND statements on the steps) rather than a logical block in the JCL. e.g. from the JCL reference: The system processes the following statements regardless of the logic of the IF/THEN/ELSE/ENDIF statement construct. They can be placed in a THEN or ELSE clause, but they are not executed conditionally. • PROC and PEND statements • JES2 and JES3 statements and commands • JCL command statements • Comment (//*) statements • INCLUDE statements • Delimiter (/*) statements • Null statements • SET statements The IF/THEN/ELSE/ENDIF statement construct does not conditionally control the processing of JCL; rather, it conditionally controls the execution of job steps. -- Andrew Rowley Black Hill Software ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
