Reading all the RPGLE sources in a library

320 pts.
Hi, please give me your idea. My recruitment is to scan all the RPGLE source in a library (Library name is my parameter). I must write all the C-spec code based on Date. If I give date as input that get all the source written > 30/12/2013. It must pick all the c-spec source alone and write it in to a Workfile or printer format. Please I'm fresher so give me an idea that I can work with. I want to write it in RPGLE.

Answer Wiki

Thanks. We'll let you know when a new response is added.

to get this info the easiest way is use PDM. Go to the source file in question, enter 25 in the first member the F13 to fill in fo all the other members. Enter “/FREE” in the find set option to “*NONE” otherwise it stops every member. Set Print List and Print Records to “Y”. You will get two reports. One lists every statement in the source member with  “/FREE” the other report is a list of all the members and their create / change dates.

Discuss This Question: 8  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb

     recruitment ??? .. is this a test to get a job?

    I won't help except to give you an idea of the data you need to work with.

    Qrpglesrc is a file.

     the first field SRCSEQ contains the sequence number,

     Srcdat contains the change day in yymmdd format

      and Srcdta contains the text.



    sample follows:

    .01	130,102	H/TITLE --- Mytest file
    1.03	130,103
    2.00	130,102	***************************************************
    3.00	130,102	*  Programmer.....: BOB THE BUILDER
    4.00	130,102	*  Date written...: 01/02/2013
    6.00	130,102	*  Purpose........: Fun, fun, fun till daddy takes the t-bird away
    Hope this helps
    54,090 pointsBadges:
  • ToddN2000
    Are you looking to get the lines of source code with that change date or source objects that match your date? There are a few ways to do this we just need to know the data you want. Source lines or Source objects?
    136,470 pointsBadges:
  • srivijay1
    No i want to read all the sources(Codes) inside the member in the source physical file (QRPGLESRC). And the conditions is, After we read all the sources in all the member and Write only the C-Spec if its fixed format and /Free if its in free format(I don't want to write D-Spec,F-Spec etc) and i have to write in to a Printer file Of a Flat File.(Any 1)

    320 pointsBadges:
  • srivijay1
    ToddN2000 Sir,  I need a source from the library(Its a Parameter) that read all the member sources.
    320 pointsBadges:
  • ToddN2000
    Try it this way. Create a workfile by doing a dspfd *MBRLIST. Then use this file and the source file in your RPGLE program. Make the Source file user controlled. Rad from your workfile, do a QCMDEXE and use an OVRDBF to the member in question. Read source records, scanning for /FREE. Write to report. At end of source file, close it. Read next work file record, open next member the same way and close. Repeat till you run all members from your workfile.
    136,470 pointsBadges:
  • philpl1jb

    The F-spec keyword EXTFILE can allow you to pass the library and file name to the program.. to use this the f spec must include USROPN and the program must contain an OPEN for the file.

     EXTMBR('ALL') should allow you to "see" rows from all members.

    The file Information data structure will have member in column 129-138



    54,090 pointsBadges:
  • srivijay1
    Hi Thanks for the Skilled Idea that helped me to start coding. I have a small douth, i done the code in Sqlrpgle to fetch all the sources in the source physical file. But it fetching only one member from the source physical file My query which i done is Select SRcSeq,SrcDta,SrcDat from MyLib/Qrpglesrc..This is fetching only one member source. Can any one pls tel me the query or logic to fetch all the member sources in source physical file.

    I attached my Code if anything which i have to improve pls tel me that will help me to be a good developer.

    FSourceF   if A E     Disk//My work file with fields SRCDATA, SRCDATE      
    DDataDs           Ds                      
    DSrcSeq                          6S 2     
    DSrcDat                          6S 0     
    DSrcDta                         80A       
    D*SqlCod           S             10S 0    
       //Set SQL Option                       
       Exec Sql                               
        SET Option                            
       //Declare th cursor                    
       Exec Sql                               
        Declare C1 Cursor for                 
         Select SRCSEQ,SRCDAT,SRCDTA from MyLib/Qrpglesrc;             
      //Open the Cursor                                                  
     Exec Sql                                                            
     Open C1;                                                            
      //Fetch data in a loop                                             
     Dou SqlCod<>0;                                                      
       Exec Sql                                                          
       Fetch C1 INTO :DataDs;                                            
          If (SqlCod<>0);                                                
        If SrcDta <> *Blanks;                                            
        If %Subst(SrcDta:6:1) = 'C' or %Subst(SrcDta:6:2)= *blanks;      
        SrcData = SrcDta;                                                
         SrcDate = SrcDat;                     
         Write SrcRec1;                        
       //Close the cursor                      
       Exec Sql                                
       Close C1;                               
      *Inlr = *On;                             
    320 pointsBadges:
  • philpl1jb

    Yes .. just one member until ..


    1. Issue an OVRDBF command with Overriding member = *all

    must be done before the Open Cursor .. might be done before the call to the RPG program, must be in job stream


    2. Each Member needs to be assigned an SQL Alias or in turn the Alias is dropped and then assigned to the next member and then the cursor is open ..processed .. closed and the allias dropped and created for the next member. 


    54,090 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: