View previous topic :: View next topic
|
Author |
Message |
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi,
I am passing two parameters in a PROC and based on those parameters I need to execute my steps in a JCL.My Proc has following steps:
// PROC AVT=,AVT1=
// IF &AVT=1 THEN
//STEP2 EXEC PGM=SAMPLE5
//STEPLIB DD DSN=TEST.COBOL.LOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
// ENDIF
// IF &AVT1=2 THEN
//STEP3 EXEC PGM=SAMPLE6
//STEPLIB DD DSN=TEST.COBOL.LOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
// ENDIF
My Job is:
//ABC JOB LASS=E,MSGCLASS=U,REGION=0M,NOTIFY=&SYSUID
//PROCLIB JCLLIB ORDER=TEST.SOURCE.JCL
//STEP01 EXEC IFTHENJ,AVT=1,AVT1=3
If I pass a different value for AVT1 variable other than 2 then my first step is executed and the next one is not executing as the condition is not satisfied Whereas when i change the value as AVT=3,AVT1=2 then both the steps are executed.
When the condition is AVT=3,AVT1=2 only my second condition should be executed.Please suggest |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What does it say in the JCL reference manual, easily reached by clicking the "IBM Manuals" button at the top of any page, about defining your own variables for comparison. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you use a different approach. . . |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
This might be a crazy WAG, but insert (as your first step in the PROC before any) an IDCAMS which issues a SET MAXCC=0. This statement needs to be assigned to //SYSIN as a PDS member or sequential file, because //SYSIN DD * stream data is not allowed in a PROC.
Give it a try....
Bill |
|
Back to top |
|
|
Jeffrey Ranney
New User
Joined: 23 Dec 2010 Posts: 20 Location: USA
|
|
|
|
You cannot SET your own variables for testing in a JCL "IF" condition, as explained in the JCL manual. You can only test RETURN-CODEs of a particular step or of the entire job. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
krishna rao M
New User
Joined: 10 Feb 2011 Posts: 9 Location: India
|
|
|
|
Hi
i think first step should not have if condition
try it like this
// PROC AVT=,AVT1=
//STEP1 EXEC PGM=DISP
//STEPLIB DD DSN=T91IPRR.RAVEENDR.COBOL.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
// IF &AVT=1 THEN
//STEP2 EXEC PGM=DISP
//STEPLIB DD DSN=T91IPRR.RAVEENDR.COBOL.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
// ENDIF
// IF &AVT1=2 THEN
//STEP3 EXEC PGM=DISP
//STEPLIB DD DSN=T91IPRR.RAVEENDR.COBOL.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
// ENDIF
you can pass different values and check it
please acknowledge me |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Did you test using &AVT= the way you have shown?
If not, do so and post the result. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
krishna rao, did you not read the previous posts in this thread? The JCL Reference manual explicitly states:
Quote: |
17.1.4.5 Relational-Expression Keywords
The following keywords are the only keywords supported by IBM and recommended for use in relational-expressions. Any other keywords, even if accepted by the system, are not intended or supported keywords.
Keyword Use
RC
indicates a return code
ABEND
indicates an abend condition occurred
¬ABEND
indicates no abend condition occurred
ABENDCC
indicates a system or user completion code
RUN
indicates that the specified step started execution
¬RUN
indicates that the specified step did not start execution |
Since &AVT is not RC, ABEND, nor any of the other supported keywords -- whether or not your JCL is accepted by the system, the IF statement is not a valid construct and may not be interpreted in the way you think. As was hinted -- and stated -- in earlier posts, you are not allowed to make up your own IF statements in JCL. You must use only the allowed keywords or the JCL will, at best, run unpredictably, and at worst not run at all. |
|
Back to top |
|
|
|