Solved

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

Posted on 2008-06-25
5
851 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wavelink TelnetCE keyboard 1 1,149
How to access power server P460 of ibm pureflex 1 221
AS400 Single Sign On 3 1,135
Excel 2016 Import Data Using Microsoft Query 6 83
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

914 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

18 Experts available now in Live!

Get 1:1 Help Now