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

Search the strings present in ps file in input pds


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bhuvana Narasimhan

New User


Joined: 22 Aug 2019
Posts: 4
Location: India

PostPosted: Thu Aug 22, 2019 8:20 pm
Reply with quote

Hi ,

I am new to this forum.I am developing an automation tool for search. Basically the search is to find the source of the DB2 table. The DB2 table names present in programs is stored in PS file which is obtained using searchfor utility . I need to search now these programs present in PS file in separate job pds where its is used. How this can be done?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Aug 22, 2019 8:32 pm
Reply with quote

Bhuvana Narasimhan wrote:
Hi ,
I am new to this forum.

Yes, it is easy to recognize.

Bhuvana Narasimhan wrote:
I am developing an automation tool for search. Basically the search is to find the source of the DB2 table.

How is it related to either JCL, or VSAM????? icon_rolleyes.gif

Bhuvana Narasimhan wrote:
The DB2 table names present in programs is stored in PS file which is obtained using searchfor utility .

How is it related to either JCL, or VSAM????? icon_rolleyes.gif

Bhuvana Narasimhan wrote:
I need to search now these programs present in PS file in separate job pds where its is used.

What did you do to achieve this?

Bhuvana Narasimhan wrote:
How this can be done?

There are obviously 100+ ways of doing this.

First of all, try something by yourself. For instance, try to understand the difference between JCL, VSAM, DB2, job, PS file, searchfor utility, and other smart words.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Aug 22, 2019 9:00 pm
Reply with quote

Bhuvana,
Welcome Here!!

To let anyone help you here, share us the sample data and expected output. So far you can use JOINKEYS with what you want to achieve but again do that first to get to the solution.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Aug 22, 2019 10:46 pm
Reply with quote

Many years ago I spent a solid six months working on such a project.

This is no easy task. I will mention a few points to consider.

Since we are talking about DB2 programs, you will not see PGM=MYPROG statement in your JCL.

You will most likely see PGM=IKJEFT1B or IKJEFT01 perhaps
You will have a SYSTSIN DD card that has the driver program perhaps in this fashion:
DSN SYSTEM (PROD1)
RUN PROGRAM (DRIVER) -
PLAN (SOMEPLAN)
END

If you are lucky, that is the program you are looking for and you got your Job name.

More likely, your program is a subroutine of another program. Hopefully you have that documented someplace and you can use your subroutine list to help you.

Don't forget about a Proc called from your Job.

Just a few thoughts to get you going.
Back to top
View user's profile Send private message
Bhuvana Narasimhan

New User


Joined: 22 Aug 2019
Posts: 4
Location: India

PostPosted: Fri Aug 23, 2019 12:51 pm
Reply with quote

@daveporcelan - I have taken all the points in consideration mentioned by you. Now am stuck with read the programs in PS file line by line and search that in job pds.

Rohit mentioned to use the Joinkeys but that can be used if am going to give 2 input PS files or instream data as input and match but my requirement is not that.

My input:
VIEW A04019T.TEST.OUTPUT2
000001 PARB206
000002 PARB208
000003 PARB209
000004 PARB217
000005 PARB218

Expected output :

Read the first line in PS file (PARB206) and search that in PDS members and if found write in output file.

In searchfor jcl we can hardcode the string that we wanted to search for but I want to read the data in file and search.Can you suggest any to proceed with.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Aug 23, 2019 4:00 pm
Reply with quote

Plenty of examples in the Rexx forums, bothe here and in the beginners forum.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Aug 23, 2019 4:36 pm
Reply with quote

You are on the right track. I used Rexx to read every program.

I had to save Working-Storage fields and the MOVE statements for values moved into them.

This is because most calls are dynamic using the WS field not a literal.

One I completed a program, its information was saved into a pds for future reference.

This way if a driver is called from more than one Job, I only had to process it one.
Same thing if a subroutine is called from multiple places.

This is a very tedious process. Mine takes six hours to run, once every two week.

Note: Rather than try to process the SQL for DB2 usage, I chose to read the SYSIBM.SYSTABAUTH table.
This has all the authorized usage for each module.

Continue on the path you are taking. you will get it.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Aug 23, 2019 9:06 pm
Reply with quote

For searching a pds I typicaly use the PDS86 program from CBTTAPE.ORG file 182.
Something like:
zz=outtrap('lst.')
"pds86 '"libname"' FI : '"string"'"
zz=outtrap('off')
Then postprocess the list.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Sat Aug 24, 2019 3:21 am
Reply with quote

Code:
//S1       EXEC PGM=SORT                                       
//SYSOUT    DD  SYSOUT=*                                       
//SORTLIST  DD  SYSOUT=*                                       
//SORTIN DD DSN="YOUR INPUT DSN"                               
//T1       DD  DSN=&&T1,DISP=(NEW,PASS,DELETE),UNIT=SYSDA,     
//             SPACE=(TRK,(1,1),RLSE),                         
//             DCB=(LRECL=88,RECFM=FB,BLKSIZE=0)               
//SYM      DD  DSN=&&S1,DISP=(NEW,PASS,DELETE),UNIT=SYSDA,     
//             SPACE=(TRK,(1,1),RLSE),                         
//             DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//SYSIN    DD    *                                             
 OPTION COPY                                                   
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(510:SEQNUM,8,ZD,             
                  500:X'7D',501:8,7,508:X'7D',509:X'6B'))     
 OUTFIL FNAMES=T1BUILD=(X,500,10,69X,510,8),REMOVECC     
 OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,                     
   TRAILER1=('LASTRCD,+',510,8)       
//S2    EXEC  PGM=SORT                               
//SYSOUT    DD  SYSOUT=*                             

//SORTLIST  DD  SYSOUT=*                             
//SORTIN DD DSN=&&T1,DISP=SHR                         
//SYMNAMES DD DSN=&&S1,DISP=SHR                       
//SORTOUT  DD  SYSOUT=*                               
//SYSIN    DD    *                                   
  OPTION COPY                                         
  OUTFIL REMOVECC,                                   
   IFOUTLEN=80,                                       
    IFTHEN=(WHEN=(81,8,ZD,EQ,LASTRCD),OVERLAY=(11:X)),
    SECTIONS=(1,1,                                   
      HEADER3=(' SELECT *',/,                         
               ' FROM SYSIBM.SYSTABAUTH',/,           
  '   AND TTNAME IN ('),                             
      TRAILER3=(' ) WITH UR;'))         


I would let you make change to HEADER3 query to following query.
Code:
SELECT SUBSTR(TCREATOR, 1 , 8) AS CREATOR                 
     , SUBSTR(TTNAME, 1 , 18)   AS NAME                                 
     , SUBSTR(GRANTEE, 1 , 8)  AS PROGRAM
     , CASE WHEN INSERTAUTH = 'Y' THEN 'C'
            ELSE '-' 
       END      AS C                                 
     , CASE WHEN SELECTAUTH = 'Y' THEN 'R'
            ELSE '-' 
       END      AS R 
     , CASE WHEN UPDATEAUTH = 'Y' THEN 'U'
            ELSE '-'
       END      AS U
     , CASE WHEN DELETEAUTH = 'Y' THEN 'D'                   
            ELSE '-' 
       END      AS D 
     , CASE WHEN COLLID = ' ' THEN '** PLAN **'
            ELSE COLLID                                 
       END      AS "PLAN/COLLECTION"
  FROM SYSIBM.SYSTABAUTH
 WHERE GRANTEETYPE = 'P'
   AND COLLID      =    'TEST'
   AND TCREATOR    =    'SYSIBM'                         
ORDER BY 3 , 2


Once ran, you will get a query formed, use DSNTIAUL to run that query and you will get what you want.
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top