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

Members search in PDS


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

New User


Joined: 16 Sep 2020
Posts: 3
Location: India

PostPosted: Wed Sep 16, 2020 11:29 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Thu Sep 17, 2020 12:19 am
Reply with quote

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
View user's profile Send private message
Dilipmg05

New User


Joined: 16 Sep 2020
Posts: 3
Location: India

PostPosted: Thu Sep 17, 2020 12:25 am
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 416
Location: Denmark

PostPosted: Thu Sep 17, 2020 12:42 am
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 869
Location: The Universe

PostPosted: Thu Sep 17, 2020 1:01 am
Reply with quote

  1. 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.
  2. 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.
  3. 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
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Thu Sep 17, 2020 1:30 am
Reply with quote

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
View user's profile Send private message
Dilipmg05

New User


Joined: 16 Sep 2020
Posts: 3
Location: India

PostPosted: Thu Sep 17, 2020 9:26 am
Reply with quote

Thank you, Joerg.

I'll try your solution ☺️☺️
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Fri Sep 18, 2020 6:57 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Fri Sep 18, 2020 7:55 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2567
Location: NYC,USA

PostPosted: Fri Sep 18, 2020 9:52 pm
Reply with quote

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
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 Fetch the Dataset names from inside m... TSO/ISPF 18
No new posts RegEX search in ISPF editor TSO/ISPF 4
No new posts ISPF search - capturing result TSO/ISPF 15
No new posts Search the strings present in ps file... All Other Mainframe Topics 8
No new posts Is possible to concatenate multiple P... DFSORT/ICETOOL 6
Search our Forums:

Back to Top