View previous topic :: View next topic
|
Author |
Message |
Lccole10
New User
Joined: 19 Feb 2020 Posts: 2 Location: US
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
Write a program to read it, and set an appropriate returncode, you cannot do this with just JCL. |
|
Back to top |
|
|
Lccole10
New User
Joined: 19 Feb 2020 Posts: 2 Location: US
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
@daveporcelan: I would add STOPAFT=1 as well to read exactly one line. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Sure that works. In this case, the requirement suggests this is a 'switch', probably a single line. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
I know my own test cases for such things, so better make it more idiot proof.. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
|