Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
IF/THEN/ELSE for JCL Steplib
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL
Author Message
MurthyJ

New User


Joined: 12 Mar 2008
Posts: 2
Location: hyd

PostPosted: Thu May 01, 2008 6:55 am    Post subject: IF/THEN/ELSE for JCL Steplib
Reply with quote

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
View user's profile Send private message
References
PostPosted: Thu May 01, 2008 6:55 am    Post subject: Re: IF/THEN/ELSE for JCL Steplib Reply with quote

dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 7342
Location: 221 B Baker St

PostPosted: Thu May 01, 2008 7:31 am    Post subject:
Reply with quote

Hello,

Sorry, no.
Back to top
View user's profile Send private message
jsathishbabu84

New User


Joined: 07 Jun 2007
Posts: 17
Location: India

PostPosted: Tue May 27, 2008 4:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj D.

Senior Member


Joined: 22 Apr 2006
Posts: 1593
Location: Mumbai, India

PostPosted: Tue May 27, 2008 5:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 438

PostPosted: Tue May 27, 2008 5:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 7342
Location: 221 B Baker St

PostPosted: Tue May 27, 2008 11:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj D.

Senior Member


Joined: 22 Apr 2006
Posts: 1593
Location: Mumbai, India

PostPosted: Wed May 28, 2008 10:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 7342
Location: 221 B Baker St

PostPosted: Wed May 28, 2008 8:53 pm    Post subject:
Reply with quote

Hi Anuj,

It is good that you have not icon_smile.gif - 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
View user's profile Send private message
Anuj D.

Senior Member


Joined: 22 Apr 2006
Posts: 1593
Location: Mumbai, India

PostPosted: Thu May 29, 2008 11:18 am    Post subject:
Reply with quote

dick scherrer wrote:
It is good that you have not icon_smile.gif
Aha, at least some one is there who understands that I'm not wrong.. icon_smile.gif. But whats' OPs' call on this, just waiting...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 2817
Location: Brussels once more ...

PostPosted: Thu May 29, 2008 12:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 43
Location: chennai

PostPosted: Thu May 29, 2008 12:54 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj D.

Senior Member


Joined: 22 Apr 2006
Posts: 1593
Location: Mumbai, India

PostPosted: Thu May 29, 2008 1:12 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 7342
Location: 221 B Baker St

PostPosted: Thu May 29, 2008 7:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
stodolas

Senior Member


Joined: 13 Jun 2007
Posts: 648
Location: Wisconsin

PostPosted: Thu May 29, 2008 7:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Anuj D.

Senior Member


Joined: 22 Apr 2006
Posts: 1593
Location: Mumbai, India

PostPosted: Fri May 30, 2008 10:26 am    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 HoursGoto page 1, 2  Next
Page 1 of 2