IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Conditional step execution based on PDS member contents


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lccole10

New User


Joined: 19 Feb 2020
Posts: 2
Location: US

PostPosted: Wed Feb 19, 2020 10:07 pm
Reply with quote

Sorry if this is a simple question, but I couldn't seem to come up with the right search criteria to find my answer.

I have a PDS member which is being used as a switch for a process.
It's contents begins with either 'UPDATE ' or 'READONLY' (followed by some positional flag which aren't relevant for my purposes).
I'd like to execute a particular step only when the value is 'UPDATE '.

Thoughts?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Feb 19, 2020 10:13 pm
Reply with quote

Write a program to read it, and set an appropriate returncode, you cannot do this with just JCL.
Back to top
View user's profile Send private message
Lccole10

New User


Joined: 19 Feb 2020
Posts: 2
Location: US

PostPosted: Thu Feb 20, 2020 12:31 am
Reply with quote

prino wrote:
Write a program to read it, and set an appropriate returncode, you cannot do this with just JCL.


I was afraid that might be the case, but was hoping there was some solution I hadn't stumbled across yet.

There is a program in a different proc (earlier within the job) that is reading it already. I guess I could have that program set it's procstep RC to something specific, and then have my later jobstep check that return code. Feels a bit messy, but maybe I'll test it out and see how it looks.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Feb 20, 2020 12:59 am
Reply with quote

If the member only has this ONE line and nothing else..

Code:
//*                                                               
//*   RC1 = STRING FOUND, RC0 = NOT FOUND, RC28 = EMPTY MEMBER   
//*                                                               
//SEARCH  EXEC PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC,NOSUMS,LMTO')     
//NEWDD  DD DISP=SHR,DSN=&SYSUID..TRIGGER.CNTL(TRIGGER)           
//OUTDD  DD SYSOUT=*                                             
//SYSIN  DD *                                                     
CMPCOLM 1:6                                                       
SRCHFOR 'UPDATE'                                                 
/*


The string 'UPDATE' must occur anywhere from column 1 to 6 in the trigger member.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Feb 20, 2020 1:07 am
Reply with quote

Another option that should work.

This will end in 0000 if UPDATE is found in SORTIN
This will end in 0004 if UPDATE is not found in SORTIN

Code:
//CHECK1   EXEC PGM=SYNCSORT,PARM='NULLOUT=RC4'
//*
//SYSOUT   DD SYSOUT=Z
//*
//SORTIN   DD *
XPDATE
/*
//SORTOUT  DD SYSOUT=Z
//*
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTFIL INCLUDE=(1,6,CH,EQ,C'UPDATE')
/*
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Feb 20, 2020 1:14 am
Reply with quote

Minor Update:

Code:
//SEARCH  EXEC PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC,NOSUMS,LMTO')   
//NEWDD  DD DISP=SHR,DSN=&SYSUID..TRIGGER.CNTL(TRIGGER)           
//OUTDD  DD SYSOUT=*                                           
//SYSIN  DD *                                                 
CMPCOLM 1:6                                                   
CMPLINE TOP 1 BTM 1                                           
SRCHFOR 'UPDATE'                                               
/*


Only LINE #1 is allowed to be searched for the string here.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Feb 20, 2020 1:17 am
Reply with quote

@daveporcelan: I would add STOPAFT=1 as well to read exactly one line.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Feb 20, 2020 1:18 am
Reply with quote

Sure that works. In this case, the requirement suggests this is a 'switch', probably a single line.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Feb 20, 2020 1:21 am
Reply with quote

I know my own test cases for such things, so better make it more idiot proof.. icon_lol.gif
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Feb 20, 2020 11:39 pm
Reply with quote

Just a note on side effects.

Your suggestion about modifying a program earlier in the job to also set the return code might backfire at some time in the future (I know - redundant!) if that program's functionality is not clearly linked to your proposed modification.

If that program is also used in other jobs that have no such requirement, then there is the added chance that someone might "clean it up."
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Capturing Job Execution Information All Other Mainframe Topics 3
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top