LIST - this rexx will fetch all PDS names like 3.4. So this fetches 150 odd proc's.
//SRHCFOR EXEC PGM=ISRSUPC,PARM=(SRCHCMP,ANYC,IDPFX,NOPRTCC)
//NEWDD DD DISP=SHR,DSN=WXXXA.AAAA.PROCLIB
// DD DISP=SHR,DSN=WXXXB.BBBB.PROCLIB
// DD DISP=SHR,DSN=WXXXB.CCCC.PROCLIB
// DD DISP=SHR,DSN=WXXXB.DDDD.PROCLIB
//OUTDD DD DISP=SHR,DSN=XXX.BASHA.SRCHOUT
//SYSIN DD *
SRCHFOR 'Dataset Name'
Above JCL searches the sting and give the lines in OUTDD.
Problems I face and Need help in below :
1. I want to code NEWDD dynamically, means I am not sure how many PDS step1 gives, so I want to give all dd names at run time to step2 NEWDD.
2. What ever result am getting as output it shows as searched from last DD -WXXXB.DDDD.PROCLIB, I want to extract the exact dd name where string found.
I have tried to search for the above someone advised to user dynamic JCL which I dont know. And am not familiar with REXX too.
Hope I understood your requirement correctly. Here is my understandings:
1. LISTDS step gets all the PDS names that are matting with WRCXXX*.*.*.PROCLIB pattern by running LIST REXX program.
2. You need to add the PDS names, that are given the above program, to SRHCFOR step under NEWDD.
Am I correct here?
If yes, you can extend the LIST REXX program functionality to update the NEWDD in the JCL, that is having SRHCFOR step, with the list of dataset names that are matching with the given pattern.
No such thing as 'dynamic' JCL. You can have dynamic allocation - in the programs that YOU write and those Utility programs that allow it e.g. the various sorts.
What you can do is write a program, it does not have to be in Rexx, that analysees the output of your first step and creates the JCL required to execute the SUPERC - one step per output file - and submit the generated job. Probably best to write it to a dataset whilst you are trying to get the thing to work and then either have your program/job submit the generated job or still have it written to a dataset and then do a manual submit.
Input to Rexx program - WRCXXX*.*.*.PROCLIB and Dataset Name
(1) first LISTCAT(WRCXXX*.*.*.PROCLIB) and get all librarys.
(2) Create the JCL statements in Rexx and write it to a PDS.Here you can
create the NEWDD dynamically based on the counts resulted in previous step.
Use looping from 1 to count and write one DD for each lib.
(3) You can even submit the JCL in rexx itself.
(4)If not JCL you can even call the Superc program from Rexx after allocating required DDs using TSO ALLOCATE.
(5)Now you wil have XXX.BASHA.SRCHOUT in your hand.But since you want DD names,some times DD names and DSNAMES may not be in same line like below.(remember Superc only list the line datasetname is present.)
MYDD DD DISP=SHR,
If so you cant get DD names from SUPERC list.
For that you need to get the corresponding proc lib using concate# and element name present in Superc list.read the elemnt and get the DD name where the dataset is refered.
I am sure this would help you much.let me know if you face any issue.