Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can batch RExx update the JCL that called it ?

Status
Not open for further replies.

RexxChef

Programmer
Nov 20, 2012
2
0
0
US
Good Day !
I recently joined a workgroup that was submitting 35 different JCLs one at a time.
Their reason for doing it this way was so that they could check the inputs for each step had been created before going to the next step. Some steps required that the input files had data, others the file could just be blank, but allocated.

To reduce all this manual effort, I combined all 35 JCLs into 1 single JCL, and put an IKJEFT1B batch Rexx step before each step (so 35 batch Rexx steps). The batch Rexx program I wrote(called "Verify") took in 1 parm - the name of the job in the NEXT step.

The logic of "Verify" was thus:
Select
If parm = Job001 then call Check_Job001
.....
If parm = Job035 then call Check_Job035
End

Each section did a LISTDSI based on the known input dataset and abended w/message if any data set was missing or empty.
The abend was a SOC4, so the entire job stopped. I also put in DJCnet to ensure each step finished successfully.
So everything is great... until....
They changed their JCLs so that if a file was not allocated, the JCL would have "NULLFILE" as the DSN.

Sigh. I was wondering if there was any way the "VERIFY" rexx batch program could output a parm to the JCL,
something like ')SET Input004 = NULLFILE' so it would be picked up by the next jobstep.

I considered creating the entire JCL dynamically in Rexx, but that would not work, as some datasets are
created in a prior step. So the Rexx Verify has to happen in between each step.

I read prior threads about Rexx that submitted JCL (internal reader), but I'm not looking to submit JCL,
just add a 'SET' line in the current jcl (that contains the batch RExx). In the past I've dynamically created sysin
cards for later steps, but in this case I am not permitted to change the logic of the program (to take in a sysin card)
as we are testing other group's code. I am only allowed to change the JCL and the "Verify" Rexx program.

Any ideas ?
Thanks in advance for putting on your thinking cap. Mine is shortcircuiting from having to submit hundreds of panels a day that Rexx could do automatically...
RP

 
Of course, if a dataset is missing or empty when it shouldn't be, the OS is going to check this for you the instant a program tries to use it --- and abend the job.

I have the most uncomfortable feeling this is a monstrous waste of your time.

What's the difference between a "dataset not found" from the OS and you finding the same condition via REXX?


Frank Clarke
--America's source for adverse opinions since 1943.
 
No you cannot do what you propose. The system 'throws away' the JCL after it has interpreted it and put the job onto the job queue.


Nic
 
Why not let the JCL do the work for you with COND code? If a program fails to allocate a dataset it should be setting some sort of return which can be used to either continue or stop. If a step abends due to a missing dataset the entire job will fail unless specific COND parameters are specified.

Start your reading here:
 
Thanks everyone for posting.
I needed to investigate why they weren't letting the JCL abend - and the reason is:
If a dataset is blank they don't want to stop the job. Instead they want to NULLFILE it,
so that it still runs (as a dummy).

I did some more investigating and found one possible answer was to use IDCAMS - repro:
REPRO -
INFILE(SYSUT1)-
OUTFILE(SYSUT2)-
COUNT(1)
If there is at least 1 record, RC=0, else RC=4.
The next step is to check the condition code of the IDCAM and file-tailor the JCL to set the
parm value to NULLFILE, like this:
//CONDIF IF IDCAMSTP.RC GT 0 THEN
)SET PARMNAME = NULLFILE
// ENDIF
It works, I'm happy and still hanging on to hope of automation.
Thanks All.
 
Suggest you/they consider making sure there Always IS a file. . . Not a big task to write an empty dataset which would be rather the same as a NULLFILE with no consideration of use at runtime. One way my clients have done this is to define a gdg base and then write an empth +1 generation. If there already is data, ok. If there is none, an empty file is processed. When reading, read the entire base and specify old,delete,keep.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top