Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

IF/THEN/ELSE for JCL Steplib

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
MurthyJ

New User


Joined: 12 Mar 2008
Posts: 1
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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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: 22
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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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: 1703
Location: Australia

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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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: 8593
Location: Back in jolly old England

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: 72
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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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

Active Member


Joined: 13 Jun 2007
Posts: 632
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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 30, 2008 10:01 pm    Post subject:
Reply with quote

Hello,

Quote:
But if the "code" is a brand-new program, only one load-library should be enough.
Usually, the concatenations are not chosen per program. The same (standard) "steplib" is typically used for testing. This prevents confusion and sporadic "missing modules". Creating different concatenations or single-library steplibs for various tests should be discouraged if not disallowed.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Mon Jun 02, 2008 10:50 am    Post subject:
Reply with quote

Hi Dick,
dick scherrer wrote:
Creating different concatenations or single-library steplibs for various tests should be discouraged if not disallowed.
This is discouraged at my site as well.

I wanted to make one point clear that one need a single Load module for some program. One might argue that s/he has same program residing in "baseline" & in "development-libraries" as well & so s/he can have two load modules of a single program..! But what if program is new program & was never "base-lined" before, what will be the coding standard then at their site..

For a given moment only one load module is in "use" & if it's new it would be found in the "development-libraries" only, this further stregthen the statement that there is no need of two different load-modules of a single program with different libraries.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Specify a "common" steplib ... Nenad JCL & VSAM 4 Wed Jan 26, 2011 2:04 pm
No new posts cics must include SYS1.xxx.SDFJAUTH ... wang_f_y1 CICS 2 Tue Aug 04, 2009 4:30 pm
No new posts Macro to Replace steplib in PROCs pavan_1811 TSO/ISPF 5 Tue Mar 17, 2009 9:30 am
No new posts Steplib addition in 100's of Procs pavan_1811 JCL & VSAM 1 Mon Mar 16, 2009 5:04 pm
No new posts JCL steplib override - not pointing l... Pedro JCL & VSAM 8 Thu Aug 28, 2008 1:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us