Openanewdoor
0 pts. | Jun 28 2005 11:30AM GMT
If I am understanding what you are asking for–this is what I did:
To run a comparison report showing Objects vs. Source Members
For each library and file you are concerned with for a source file–Do this:
DSPFD (LIBRARYNAME/QRPGSRC) TYPE(*MBRLIST) OUTPUT(*OUTFILE)OUTFILE(COMPAREFILE) OUTMBR(*FIRST *ADD)
For each Object that should be the primary file for your compare
DSPOJD OBJ(OBJECTLIBRARY/*ALL) OBJTYPE(*FILE *MODULE *PGM) DETAIL(*BASIC) output(*outfile) OUTFILE(librayname/NAMEOFOUTFILE)
NOW , MAKE A COMPARE QUERY OPT-3 AND *EQ FOR THE COMPARE FIELDS
*****************************************************
Hope this helps
astradyne
370 pts. | Jun 28 2005 11:41AM GMT
I did something similar to this a while ago where I had to find all of the physical files in a library and used embedded SQL to find the details. The following will find all source files on the system:
C/Exec SQL
C+ Declare csrSysTables Cursor for
C+ Select Sys_Tname, Sys_Dname
C+ From SysTables
C+ Where Type In(’P',’T') and FileType = ‘S’
C/End-Exec
C/Exec SQL
C+ Open csrSysTables
C/End-Exec
To read through the list of source files using SQL, use the following:
C/Exec SQL
C+ Fetch Next from csrSysTables into :SrcFil, :SrcLib
C/End-Exec
Variables SrcFil and SrcLib should be defined as 10 character fields.
For each record found you would need to do a DSPFD using:
DSPFD FILE(srclib/srcfil) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/SRCMBRS) OUTMBR(*FIRST *REPLACE)
Use SQL similar to the example shown above to read through the file member list in QTEMP and then use the following to create an ALIAS to allow you to read through your source member:
C Eval MySqlStmt = ‘Create Alias QTEMP/’ +
C ‘alsSRCMBR For ‘ +
C %Trim(SrcLib) + ‘/’ +
C %Trim(SrcFil) + ‘(’ +
C %Trim(SrcMbr) + ‘)’
C/Exec SQL
C+ Prepare prpSRCMEMBER
C+ From :MySqlStmt
C/End-Exec
C/Exec SQL
C+ Execute prpSRCMEMBER
C/End-Exec
You need to use an Alias in order to override the member name to be read. The following can then be used to open the source member:
C Eval MySqlStmt = ‘Create Alias QTEMP/’ +
C ‘alsSRCMBR For ‘ +
C %Trim(vSrcLib) + ‘/’ +
C %Trim(vSrcFile) + ‘(’ +
C %Trim(vSrcMbr) + ‘)’
C/Exec SQL
C+ Prepare prpSRCMEMBER
C+ From :MySqlStmt
C/End-Exec
C/Exec SQL
C+ Execute prpSRCMEMBER
C/End-Exec
C Eval MySqlStmt = SqlStmt + ‘QTEMP/alsSRCMBR’
C/Exec SQL
C+ Prepare prpSRCFILE
C+ From :MySqlStmt
C/End-Exec
C/Exec SQL
C+ Declare csrSRCFILE Cursor
C+ For prpSRCFILE
C/End-Exec
C/Exec SQL
C+ Open csrSRCFILE
C/End-Exec
And the following to read it:
C/Exec SQL
C+ Fetch csrSRCFILE Into :SrcRec
C/End-Exec
* Check for an error…
C If SQLCod 0
C EndIf
Before you can use the next member, you will need to close the cursor before re-opening it:
* Drop the SQL alias…
C/Exec SQL
C+ Drop Alias alsSRCMBR
C/End-Exec
And close the source file cursor at the end of the program:
* …and close the cursor…
C/Exec SQL
C+ Close csrSRCFILE
C/End-Exec
Hope that helps
All the best
Jonathan
JPLamontre
0 pts. | Jun 29 2005 2:03AM GMT
DSPFD FILE(*USRLIBL/*ALL) TYPE(*MBRLIST) +
OUTPUT(*OUTFILE) FILEATR(*PF)
or
DSPFD FILE(MYLIB/*ALL) TYPE(*MBRLIST) +
OUTPUT(*OUTFILE) FILEATR(*PF)
is an other way of analysis
jaicee
0 pts. | Jul 5 2005 12:17AM GMT
if you’re processing the members in a CL pgm, you also might want to check out the Retrieve Member Description (RTVMBRD) command.
TomLiotta
7990 pts. | Oct 27 2009 6:13AM GMT
What do you mean by “retrieve”? Do you want to create a list of all source members? (List into a file? Print a list?) Or do you want to copy all source members into some other file? Do you want to copy them to a PC? Do you want to read the lines from source members into a program?
Tom






