View previous topic :: View next topic
|
Author |
Message |
sumeetanair
New User
Joined: 21 Sep 2008 Posts: 1 Location: india
|
|
|
|
hi,
I have a situation where i need to execute a step in a proc only if the file name starts with value=ICLP; in the JCL there is a symbolic parameter defined for the 1st qualifier of the file as ENV=ICLP.
So, when i tried to use
// IF (&ENV EQ 'ILT4') THEN
//ICL34ATC EXEC PGM=WCS2100
.....
it showed JCL error; could you help me how to do this?
thanks in advance |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
DO NOT add your topic at the end of an existing one. Learn how to start a new topic.
You can not use IF/THEN/ELSE logic to do what you need. |
|
Back to top |
|
|
neontech Warnings : 1 New User
Joined: 08 Dec 2009 Posts: 11 Location: mumbai
|
|
|
|
You can identify... using IF condition...
You will have to use listcat... to identify the first hlq and then based on that only you can skip the processing.. that is a lenghty process |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
neontech wrote: |
You can identify... using IF condition...
You will have to use listcat... to identify the first hlq and then based on that only you can skip the processing.. that is a lenghty process |
Please read the original post, and then explain how your response is of any help to the OP. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Quote: |
You can identify... using IF condition...
You will have to use listcat... to identify the first hlq and then based on that only you can skip the processing.. that is a lenghty process |
Please stop posting "things" that have not been tested and are just wrong. . .
This is not some chat room or blog where people are encouraged to just "throw in" anything they feel like posting
d |
|
Back to top |
|
|
lalitsharma_77
New User
Joined: 29 Nov 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Sumeeta Nair,
The symbolics can be checked using IF/ELSE condition only in one case. If you pass a numeric value. I have tested this multiple times and it worked.
Thanks
Lalit |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
The symbolics can be checked using IF/ELSE condition only in one case. If you pass a numeric value. I have tested this multiple times and it worked. |
bullsith
if You disagree on my comment
please post ...
the page of the manual with the reference to such behavior
the jcl You submitted,
the jes output
strong evidence that the IF statement worked according to Your thinking
( should hold in any IT court ) |
|
Back to top |
|
|
lalitsharma_77
New User
Joined: 29 Nov 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Enrico,
I have tested this again:
JOB: (CATALOG PROC IN JOB LOOKS LIKE)
Code: |
//CONDIFPR EXEC CONDIFPR,
// C='1',
// Q='*'
|
PROC:
Code: |
//CONDIFPR PROC C=''
//*
//*******************************************************
//COND01 IF &C = 1 THEN
//STEP001 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=&Q
//SYSPRINT DD SYSOUT=&Q
//SYSUDUMP DD SYSOUT=&Q
//SYSIN DD DSN=..........................(........),DISP=SHR
// ENDIF
|
When I ran SCANTEST or JCLB or !JCK (the command used to check the syntax) it gave me following result without any warning as well as errors. When I submitted it ran fine and I created a GDG base.
//***********************************************************
//CONDIFPR EXEC CONDIFPR,
// C='1',
// Q='*'
P1//CONDIFPR PROC C=''
P1//*
P1//*********************************************************
P1//COND01 IF &C = 1 THEN
P1--COND01 IF 1 = 1 THEN
P1//STEP001 EXEC PGM=IDCAMS
P1//SYSOUT DD SYSOUT=&Q
P1--SYSOUT DD SYSOUT=*
P1//SYSPRINT DD SYSOUT=&Q
P1--SYSPRINT DD SYSOUT=*
P1//SYSUDUMP DD SYSOUT=&Q
P1--SYSUDUMP DD SYSOUT=*
I have never gone through any manual so cannot show you in that. But I am sure it works as this is working in PROD region daily.
Thanks
Lalit |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
In my shop (z/OS V1R9) it works at you'd expect. First, our !JCK says that that's an error:
//CONDIFPR EXEC CONDIFPR,
// C='1',
// Q='*'
XXCOND01 IF &C = 1 THEN
SUBST JCL - 1 = 1 THEN
CAY6037E UNKNOWN KEYWORD "1" SPECIFIED IN OPERAND OF "IF"
and the job ALWAYS executes STEP001 no matter what the value of 'C' is set to (as long as it's numeric). |
|
Back to top |
|
|
lalitsharma_77
New User
Joined: 29 Nov 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Kevin,
Yes, when I tried '2' that time also it executed IDCAMS and created the GDG base.
Does this means that IF condition works with any numeric value passed as in symbolic and it never checks the value because in our region it is working fine. Right now we do have only one value and we might increase thsi number?
Thanks
Lalit |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is a manuals link at the top of the page. The JCL Language Reference manual includes
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 &C is not RC, ABEND, ¬ABEND, ABENDCC, RUN, or ¬RUN your use of it in an IF test in JCL is neither intended nor supported by IBM. In other words, it may not do what you think it does, and if you get results other than what you think you should -- good luck because IBM isn't going to help you get it working the way you think it should. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Hi Lalit!
I just tested Your sample, and it works
seems to rely on the fact that 1 = 1 is a logical expression for which no variable evaluation must be performed
looks like a bug of the converter/interpreter
I would define it against any good practices and official IBM docs
I believe that the approach even if working would not pass any audit nor quality assurance |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Enrico,
Quote: |
nor quality assurance |
Depends on what the organization considers QA. . .
One place i supported had a QA policy that if a module was compiled more than 30 days ago it could no longer be promoted. . . Not only did the compile have to be recent, but all of the testing results had to be after the compile (which does make sense). . .
I guess the code got "grubby" sitting in the libraries - untouched . . .
d |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I'm just curious about the discrepancies between our systems, why it works on some and not on others. |
|
Back to top |
|
|
lalitsharma_77
New User
Joined: 29 Nov 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Superk/Enrico/Robert/Dick,
You guys are my life saver . I do agree that &C (or other symbolics) are not frequently used as compare to ABEND and RC. I will definitly go through all the possible manauls to look into this again.
Thanks a lot for your directions. |
|
Back to top |
|
|
lalitsharma_77
New User
Joined: 29 Nov 2007 Posts: 10 Location: Pune
|
|
|
|
Hi Moderators,
I moved 1 step ahead from this point. I modified my job (same job above) to execute 2 steps depending upon symbolic passed using IF/THEN and ELSE. The executed both the steps . So far my understanding is, it is not a good practice to use IF/THEN/ELSE with symbolics.
Thanks
Lalit |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
why it works on some and not on others |
And with which upgrade or ptf the behavior might change. . . |
|
Back to top |
|
|
|