|
|
| Author |
Message |
MurthyJ
New User
Joined: 12 Mar 2008 Posts: 2 Location: hyd
|
|
|
|
Hi Friends,
Can we use IF/THEN/ELSE conditions as follows,IF
SO can you please provide me an example...
//STEP1 TO READ A FILE
(The file will have a single value either 1 or 0)
//STEP2 EXEC PGM=P1
//IF FILE.VALUE = 1 THEN
//STEPLIB DD DSN=LOAD1 LIBRARY
//ELSE
//STEPLIB DD DSN=LOAD2 LIBRARY
//ENDIF
Its really appreciable. |
|
| Back to top |
|
 |
References
|
Posted: Thu May 01, 2008 6:55 am Post subject: Re: IF/THEN/ELSE for JCL Steplib |
 |
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7515 Location: 221 B Baker St
|
|
|
|
Hello,
Sorry, no. |
|
| Back to top |
|
 |
jsathishbabu84
New User
Joined: 07 Jun 2007 Posts: 15 Location: India
|
|
|
|
Hi Murthy,
You can code STEP1 to give two return codes for the file values 1 and 0.
Based on the return code of STEP1, STEP2 Steplib can be changed.
// IF STEP1.RC EQ 0 THEN
//STEP2A EXEC PGM=P1
//STEPLIB DD DSN=LOAD1 LIBRARY
.
.
// ELSE
//STEP2B EXEC PGM=P1
//STEPLIB DD DSN=LOAD2 LIBRARY
.
.
// ENDIF
Regards,
SJ |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1707 Location: Mumbai, India
|
|
|
|
Hi,
Might be with a little trick this can be done, but in any case I would suggest to revise the logic to execute two different programs. .. ofcourse if You want to use two different load-libraries with same program name, they are nothing but two different load modules/programs.. |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 457
|
|
|
|
Murthy,
as Dick has stated previously, you cannot achieve this without repeating the steps, you cannot include just the STEPLIB based on previous step return code.
You will need somthing like SJ has mentioned.
Here is a way of achieving this
| Code: |
//SEARCH EXEC PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC')
//NEWDD DD *
0
//OUTDD DD SYSOUT=*
//SYSIN DD *
SRCHFOR '1',01:01
/*
//*********************************************************************
//CHECK01 IF (SEARCH.RC = 1) THEN
//*
//STEP2A EXEC PGM=P1
//STEPLIB DD DSN=LOAD1,DISP=SHR
// ELSE
//STEP2B EXEC PGM=P1
//STEPLIB DD DSN=LOAD2,DISP=SHR
//*********************************************************************
//CHECK01 ENDIF
|
Gerry |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7515 Location: 221 B Baker St
|
|
|
|
Hello,
When i posted that you can't do what you asked with jcl, i (foolishly) figured that you would find a more proper implementation.
This may sound a bit strong, but it is a very bad practice to have the same production program name in different loadlibs - it should not be allowed. If the functionality is actually different, there should be 2 names. If there is only a slight difference, a single module with a PARM might be a good choice.
Sounds like there is no configuration management in place or this would not even be a question. Does this mean that the source code is also not managed? |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1707 Location: Mumbai, India
|
|
|
|
Hi,
Lets' leave all the discussion, please let me know why there are two different libreairs for a single load-module; I might sound dumb, but I've never used this type of approach & then why should I use, what's the benefit. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7515 Location: 221 B Baker St
|
|
|
|
Hi Anuj,
It is good that you have not - it is yet another thing that can be done but should not be done.
There is no real benefit. It is done because a proper way is not used (due to not knowing any better or someone wanting some short-cut). |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1707 Location: Mumbai, India
|
|
|
|
| dick scherrer wrote: |
It is good that you have not |
Aha, at least some one is there who understands that I'm not wrong.. . But whats' OPs' call on this, just waiting... |
|
| Back to top |
|
 |
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 2963 Location: Brussels once more ...
|
|
|
|
You can also use IDCAMS.
Note the use of PARM= on the EXEC card to ensure that the value will not be ignored if it is in CC01.
You can then use normal IF/THEN/ELSE to check the RC from the previous step
| Code: |
//IDCAMS EXEC PGM=IDCAMS,PARM='MARGINS(1 72)'
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SET MAXCC EQ -
// DD DSN=dataset with number in it,DISP=SHR
|
|
|
| Back to top |
|
 |
birdy K
New User
Joined: 05 Mar 2008 Posts: 45 Location: chennai
|
|
|
|
Hi everyone,
I have a doubt that we can concatenate a libraries for a single program. If it not found there in first library , it will search in second library. Isnt it? If there is any change in pgm, the load module will be different. So I think the load module will not be different . Only load libraries name will be different. If I am wrong, Please guide me. |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1707 Location: Mumbai, India
|
|
|
|
| birdy K wrote: |
| If there is any change in pgm, the load module will be different. So I think the load module will not be different . Only load libraries name will be different. |
If I understood this correctly, yes this is a usual convention to concatnate load libraries. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 7515 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| If I am wrong, Please guide me |
It is most uncommon to have only a single loadlib. They are always concatenated.
Many test environments environments have repair, then test, then production, then "product" libraries, then system libraries concatenated in that order. The production concatenation is like that without the test library. |
|
| Back to top |
|
 |
stodolas
Senior Member
Joined: 13 Jun 2007 Posts: 646 Location: Wisconsin
|
|
|
|
We have 8 loadlibs for our programs.
PROD.BATCH.LOADLIB
PROD.CICS.LOADLIB
BENCH.BATCH.LOADLIB
BENCH.CICS.LOADLIB
CLIENT.BATCH.LOADLIB
CLIENT.CICS.LOADLIB
UNIT.BATCH.LOADLIB
UNIT.CICS.LOADLIB
A program can reside in all 4 (batch or CICS) at any given time. However we concatenate our loadlibs as follows:
Production batch/cics only looks to PROD.*.LOADLIB
Benchmark looks to BENCH.*.LOADLIB and PROD.*.LOADLIB
Client looks to CLIENT.*.LOADLIB and PROD.*.LOADLIB
Unit looks to UNIT.*.LOADLIB and PROD.*.LOADLIB
This ensures that even if a program isn't at the current promotion level it can look to prod to find what should be a working copy. |
|
| Back to top |
|
 |
Anuj D.
Senior Member
Joined: 22 Apr 2006 Posts: 1707 Location: Mumbai, India
|
|
|
|
Hi,
| stodolas wrote: |
| A program can reside in all 4 (batch or CICS) at any given time. |
And the most "updated" code (Load Module) should exist in "first" library in the concatenated-list.
But if the "code" is a brand-new program, only one load-library should be enough. |
|
| Back to top |
|
 |
|
|