Friday, June 21, 2013

MBRLIST - Print Member List of a PDS to a Flat File

There are times at which You would want to dump the list of members in a PDS Library to a flat file, for Analysis Purpose. The below exec does so. You can enhance upon this one to compare the members of different PDS and so on.

/*---------------------------Rexx----------------------------------*/
/* Atom - May 2013                                                 */
/*-----------------------------------------------------------------*/
/* This Exec Prints the list of members of a PDS into a Flat File  */
/*-----------------------------------------------------------------*/
   Address TSO
   oPrtDS = " "
   inPDS   = " "
   parse arg inPDS
   do while inPDS = " "
      Say "Enter PDS Name Or X to Exit :"
      Parse Upper pull inPDS
   end
   inPDS = strip(inPDS,b)
   inPDS = strip(inPDS,b,"'")
   if inPDS = "X" | inPDS = "x" then exit
   do while oPrtDS = " "
      Say "Enter Print PS Name Or X to Exit :"
      Parse Upper pull oPrtDS
   end
   oPrtDS = strip(oPrtDS,b)
   oPrtDS = strip(oPrtDS,b,"'")
   if oPrtDS = "X" | oPrtDS = "x" then exit
   ScanList  = "'" || oPrtDS || "'"
   PDSName = "'" || inPDS || "'"
   xx = outtrap('ON')
   x=sysdsn(ScanList)
   xx = outtrap('OFF')
   if x = 'OK' then do
      xx = outtrap('ON')
      "delete "ScanList
      xx = outtrap('OFF')
   end
   "alloc F(ScanList) da("ScanList") unit(sysda) space(100,50)" ,
        || " tr dsorg(ps) recfm(F B) lrecl(80) new reuse"
   "execio 0 diskw ScanList (open"
   ScanListRec = " "
   x = outtrap("PDSmemlist.")
   "listds "PDSName" members"
   ScanListRecsNbr = 0
   x = outtrap("off")
   do dummyidx = 1 to PDSmemlist.0
      if PDSmemlist.dummyidx = "--MEMBERS--" then do
          PDSmemlistbeg = dummyidx + 1
          leave
      end
   end
   do PDSmemlistidx = PDSmemlistbeg to PDSmemlist.0
      mbr = strip(PDSmemlist.PDSmemlistidx,b)
      ScanListrec = mbr
      push ScanListRec
      "execio 1 diskw ScanList"
      ScanListRecsNbr = ScanListRecsNbr + 1
   end
   "execio 0 diskw ScanList (finis"
   "free f(ScanList"
return


Wednesday, June 19, 2013

Xref and Impact Analysis Tool for Mainframe Applications

As a mainframe programmer or designer, we would have done the impact analysis of changing a component (be it a copybook or a SYSIN card or a DB2 Table or a program or a JCL or so on), which we have to do a lot of times. For doing this we usually run SRCHFOR or PDSMAN scans to find out the cross reference of the modules in other components.
Say for example, we have to change a copybook, we search for all the cobol programs which use the copybook so as to see if a compile is required. Further we would be searching for these Cobol programs in the JCL and Proclib Libraries to see all the places where these programs are used. The process continues till we reach the end point of analysis.
Now this process takes a lot of efforts and time as a lot of time is wasted to run the searches and this also breaks the flow of analysis of the modules, which is the actual work of the programmer. To overcome this problem, I have built the Xref and Impact Analysis tool.

Tool Components and Modules:
The tool essentially has two major processes:
  • Xref Build Process which scans for cross references of the modules amongst the related components. This is the backend process which can be run periodically depending on the frequency of your application changes.
  • The Tool Interface which the programmer uses to find the cross references of any module and aids in the impact analysis process.
The tool consists of the following modules:
Rexx Programs:
  • XREFCBLD : Scans for Cross Reference between modules. Like Cross Reference of copybooks in Cobol Programs and Cobol Programs in Sysins and JCLs etc. The scans are done based on the definitions of source-target relationships in the Inrelf File.
  • XREFDBLD: Scans for cross references of DB2 tables and views in Application components. The DB2 tables and views used in application modules are gotten from the sysibm.systables with given qualifiers as mentioned in the INRELF files.
  • XREF: This is the Interface program, which the programmer uses for his impact analysis.  This screen presents to you the cross-reference data that has been built by the previously mentioned modules in a manner which aids you in your multi level impact analysis process. 

ISPPLIBs: XREFPNL1 and XREFPNL2

Parameter File: INRELF: This is the main driver file to build the Xref Databases. You mention The source libraries along with their relationship with the target libraries. This will be discussed in more details in the set up secion. A sample INRELF file is also present in the zip file.

All these modules are attached in the zip file below.


Set Up Process:
  • Place the rexx modules in your rexx library and the ISPF panels in your ISPPLIB library.
  • Set up Your Inrelf File. The structure of the inrelf File is as below:
Position 1 – 40 : Target Library. Target Library is the library whose modules may be referenced in the modules of the Source Library.
Position 41 – 50: Type of Target Library components. Basically below are the types for various kinds of components:
- Sysins: SYSN
- Copybooks: COPY
- JCLS: JCL
- Cobol Programs: COB
- JCL Procs: JPRO
- EZT Programs: EZT
- EZMaclibs: EZM
- DB2 tables and Views: DB2
Position 51 – 90: Source Library. It is the library whose members are scanned thru to find if they contain the names of the members of the Target library.
Position 91 – 100: Source Library Type.
Comments can be written starting with “—“ i.e two dashes or hyphens.
Excepting for the comments, the data records should be sorted based on Traget Library. i.e ideally all the records for the same target library should be placed together in the file.
  • Set the following variables in the init_Process routine of the XREFCBLD,XREFDBLD and XREF Rexx programs: hlq1, hlq2, hlq3, inrelf, "LIBDEF ISPPLIB".
  • Run the XREFCBLD and XREFDBLD commands which submits various scan jobs – one each for every Target Library in Inrelf File. Note that the execution of the command may take some time depending on the number of libraries defined as target and source libraries. The command goes inside each PDS and first cross verifies existence, finds number of members, builds scan member list etc before submitting the jobs. You can very well call these commands from a batch job scheduled in your scheduler.  The jobs will create the output XREF Data files with names “(hlq1).(hlq2).(jobname).(type).SCANRPT”. Please note that these jobs are restartable from the abending step in case they abend for some reason.
  • After all the jobs are done, You can go ahead and start using the tool using XREF command. The usage of the XREF command tool is explained below.

Tool User Guide:




Popular

Featured

Three Months of Chadhei