Solved

How do I create a CL to do a mass-compile of source programs?

Posted on 2008-06-25
5
845 Views
Last Modified: 2012-06-21
Hi,
I am looking at streamlining all or part of a process which involves doing many recompiles of source programs each year.  These source programs are contained in a common library.  The basic gist of the CL would be to submit a source program compile for all the members of a library, one by one, (or all at once) until it has compiled the last member in the library.  This, I think, would save time over compiling each member individually.  Any idea how to structure such a CL?  Currenly we are using the PDM environment, using option 14 which submits the command CRTBNDRPG for create bound RPG program.  I would like to have a skeleton CL that would submit each source member in the library.  
Thank you
0
Comment
Question by:wendelina
5 Comments
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 100 total points
ID: 21871069
wendelina:

First thing I'd do is look at ways to avoid it in the first place. This might involve a "phased in" process where a few programs at a time have their source copied to a new source file (and deleted from old), changes are made to eliminate the need for recompiles, and those programs are recompiled once. All programs left over would still go through the periodic-recompile process. Depending on why recompiles need to be done, the ways to implement this would vary.

Then, I'd review the information that can be gathered that might guide an automated process.

For example, if this involved "all bound programs in library X", I might use the List ILE Program Information (QBNLPGMI) API to list all *PGM (and List Service Program Information (QBNLSPGM) API for *SRVPGM?) objects. Note that format PGML0100 contains info on each module including the source library/file/member. Because 'compile' for ILE means 'compile modules', each entry in that list would be subject to compilation.

However, if you're thinking about OPM programs, then you might use the QUSLOBJ API to list the *PGM objects and call the Retrieve Program Information (QCLRPGMI) API with format PGMI0100 to extract source library/file/member info for the compiles.

Well, perhaps the above is a little beyond what you were thinking...

If so, then perhaps a CL program could have a library name as an incoming parm. It would issue a DSPOBJD &parmlib/*ALL objtype(*PGM) detail(*SERVICE) output(*OUTFILE) outfile(QTEMP/RECOMPPGM) command. It would then do a RCVF loop over that file and compile each program that had source info in its record. If no source info was supplied, you'd need to use one of the ILE APIs above for that object to locate the source -- unless you somehow knew where the related source was and you could use CRTBNDRPG directly.

In short, it depends on a few things.

1. Is there a single source file in a single library?
2. Are all programs the same language and environment (OPM or ILE)?
3. Are all programs to be created in the same library?

It really isn't particularly complex for any part of the process in CL. It's more that there are a variety of possible components. And, you'll be better off in the long run if you start with the components and program structure that will make things easier in the future. E.g., using CRTBNDRPG for every program pretty well stops you from easily going to any multi-module programs.

Any elaboration you can add?

Tom
0
 
LVL 27

Expert Comment

by:tliotta
ID: 21871083
BTW, your question _implies_ that all programs are single-module ILE RPG and that source member, module and program names are all the same. If that's _not_ true, please let us know.

Tom
0
 
LVL 13

Accepted Solution

by:
_b_h earned 300 total points
ID: 21871823
A couple of suggestions:

1) Using PDM, put in 14 in front of the first member, then press F13 to put the same option in front of all subsequent members. This can be customized using a user-defined PDM option.

2) Try the following program; it needs testing/tweaking but should get you started:

PGM (&SRCLIB     /* LIBRARY           NAME, *LIBL, *CURLIB...      */ +    
     &SRCF       /* SOURCE FILE(S)    NAME, GENERIC*, *ALL         */ +    
     )                                                                      
/**/                                                                        
DCL &SRCLIB     *CHAR     10                                                
DCL &SRCF       *CHAR     10                                                
/**/                                                                        
DCLF QAFDMBRL                                                              
/**/                                                                        
             DSPFD      FILE(&SRCLIB/&SRCF) TYPE(*MBRLIST) +                
                          OUTPUT(*OUTFILE) OUTFILE(QTEMP/QAFDMBRL)          
             OVRDBF     FILE(QAFDMBRL) TOFILE(QTEMP/QAFDMBRL)              
NEXTMBR:                                                                    
             RCVF                                                          
             MONMSG ( CPF0864 ) EXEC(DO)                                    
                GOTO ENDOFFILE                                              
                ENDDO                                                      
             SBMJOB     CMD(CRTBNDRPG PGM(&MLLIB/&MLNAME) +                
                          SRCFILE(&MLLIB/&MLFILE) SRCMBR(*PGM)) +          
                          JOB(&MLNAME)        
             GOTO NEXTMBR                      
ENDOFFILE:                                    
             DLTOVR QAFDMBRL                  
ENDPGM:                                        
             ENDPGM                            

Post back any questions!
Barry
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 21873037
Hi wendelina,

Go for Barry's first remark "Using PDM, put in 14"
special parameters you can add to the commandline as
REPLACE(*YES)  USRPRF(*OWNER)  or whatever you like
This will be used for every compiled source.

Regards,
Murph
0
 

Author Comment

by:wendelina
ID: 21899109
I agree with the 14 option.  I was overthinking the "bang" that we could get out of mass-compiling.  It will take less time to simply take that option.  
TLiotta: thank you that is way more than I understand about RPG programs - I appreciate immensely the thought you put into that one.
Regards and many thanks,
Wendy
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now