|
View previous topic :: View next topic
|
| Author |
Message |
Dilipmg05
New User
Joined: 16 Sep 2020 Posts: 3 Location: India
|
|
|
|
Hello All,
I have a PDS that contains thousands of SIT JCLs and UAT JCLs.
SIT jcls are like SITJOB1. Corresponding UAT jcl will be like UATJOB1 and so on.
Now that I need to scan this common pds to see if all SIT jobs have corresponding UAT version.. Is there a logic in JCL that could help me to scan this PDS?? Thanks in advance.. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
Provide sample data for Input/Output that one can see what logic would be required and what program to use for.
In general you can use e.g. IEHLIST or LISTDS to get a list of Member Names and process them in a later step with a SORT utility to find the matching pairs. |
|
| Back to top |
|
 |
Dilipmg05
New User
Joined: 16 Sep 2020 Posts: 3 Location: India
|
|
|
|
PDS NAME - ABC.TEST.JCLLIB
Members example-
SITJOB1
UATJOB1
SITJOB2
UATJOB2
...
...
....
...
SITJB991
UATJB991
SITJB992
SITJB993
UATJB993
I need a logic to scan pds and final output should indicate me that, job SITJB992 doesn't have corresponding UAT jcl.. |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 766 Location: Denmark
|
|
|
|
1. IEHLIST LISTPDS output
2. ISPF SRCHFOR in batch
3. Merge the lists and pick where members from list1 is not in list2.
This is a programming exercise, not JCL.
Both lists could also be generated by the PDS86 program from file 182 at Use [URL] BBCode for External Links and probably by other means too, File Manager perhaps? |
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
- JCL is not a programming language or a scripting language like Shell in Unix or Perl. It cannot loop, nor can it directly obtain and analyze data. It is simply a means to direct the system to run user programs and specify at least some of the data resources the programs require.
- The first part of your task is to obtain the member names in the Partitioned Data Set. Joerg.Findeisen proposed using IEHLIST or LISTDS. Personally, I cannot recommend IEHLIST. It is simple to run in a batch environment, but its setup requirement in JCL is slightly complicated. LISTDS is a TSO line mode command. Unlike IEHLIST it requires a TSO environment to run, but its printed output is slightly easier for another program to process. Mr. Jensen suggested using ISPF SRCHFOR, but ISPF requires moderately complex JCL to prepare the environment for ISPF, so I so not think that is very viable. If PDS86 is already available in your environment it might be a viable alternative to LISTDS.
- With the list of members, you can easily write a program to analyze the list. The program can be in any computer language you are comfortable using.
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
Simple approach:
| Code: |
//LISTPDS EXEC PGM=IEHLIST
//SYSPRINT DD DISP=(NEW,PASS),UNIT=SYSALLDA,
// SPACE=(CYL,(10,5),RLSE),
// DSORG=PS,RECFM=FBA,LRECL=121,BLKSIZE=0
//DD1 DD UNIT=SYSALLDA,VOL=SER=<fromvol>,DISP=SHR
//SYSIN DD *
LISTPDS DSNAME=<mydsn>,VOL=SYSALLDA=<fromvol>
/*
//MATCH EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=(OLD,PASS),DSN=*.LISTPDS.SYSPRINT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(1,1,SS,EQ,C'01',OR,12,1,CH,EQ,C' ',OR,22,8,BI,NE,UN,OR,
12,3,SS,NE,C'SIT,UAT')
INREC IFTHEN=(WHEN=(12,3,CH,EQ,C'SIT'),BUILD=(15,5,X,X'10',1Z)),
IFTHEN=(WHEN=NONE,BUILD=(15,5,X,X'01',1Z))
SORT FIELDS=(1,5,BI,A)
SUM FIELDS=(7,2,BI)
OUTFIL FNAMES=(SORTOUT),
OMIT=(7,1,BI,EQ,X'11'),
REMOVECC,NULLOFL=RC4,
IFTHEN=(WHEN=(7,1,BI,EQ,X'10'),
BUILD=(C'SIT',1,5,X,C'has no matching UAT')),
IFTHEN=(WHEN=NONE,
BUILD=(C'UAT',1,5,X,C'has no matching SIT'))
END
/* |
Input:
| Code: |
Name
_________ SITJOB1
_________ SITJOB2
_________ SITJOB99
_________ UATJOB1
_________ UATJOB3
_________ UATJOB99 |
Output:
| Code: |
****** ****************************
000001 SITJOB2 has no matching UAT
000002 UATJOB3 has no matching SIT
****** **************************** |
Job will end with RC=4 if all matches are Ok. |
|
| Back to top |
|
 |
Dilipmg05
New User
Joined: 16 Sep 2020 Posts: 3 Location: India
|
|
|
|
Thank you, Joerg.
I'll try your solution ☺️☺️ |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3108 Location: NYC,USA
|
|
|
|
How about this approach ?
1. Use IEHLIST to get input Data Set with all Member names.
2. Sort the file from pos-4 till next 5 bytes.
3. Use this link to separate Duplicate vs unique. The unique Data set created is the one you are looking for.
Split a file into unique vs duplicate records |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
| Rohit Umarjikar wrote: |
| 2. Sort the file from pos-4 till next 5 bytes. |
This extra step is not necessary when using the mentioned ICETOOL SELECT .. NODUPS method. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3108 Location: NYC,USA
|
|
|
|
| yes indeed but just to explain the flow step 2 and 3 = 1 step. So overall two step easy solution and should work. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|