Solved

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

Posted on 2008-06-25
5
909 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The recent Petya-like ransomware attack served a big blow to hundreds of banks, corporations and government offices The Acronis blog takes a closer look at this damaging worm to see what’s behind it – and offers up tips on how you can safeguard your…
This article outlines the struggles that Macs encounter in Windows-dominated workplace environments – and what Mac users can do to improve their network connectivity and remain productive.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

630 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