Introducing utility Check Compilation (CHKCMP). It takes a number of source members and finds out if corresponding objects were created after the last change to each of the source members, making it very useful when working with large numbers of source members.
Programmers often need to make sure that a group of source members has been compiled successfully. If youre a consultant who has just uploaded five dozen source members to a clients AS/400 and compiled it there, you face quite a chore. Your message queue may have been cleared at the clients machine, and your compiler listings and job logs may be gone when you sign back on. The utility presented here, Check Compilation (CHKCMP), can be a huge time-saver. You can find the complete code for the utility on the MC Web site at www.midrangecomputing.com/mc/99/02.
CHKCMP asks for the name of a source file and a range of source member names. Then, it checks to see if all of those members have corresponding objects in a library you specify. But thats not all it does; if the object exists, it also checks to see if the objects creation timestamp is greater than (or equal to) the timestamp of the source members last change.
All results are reported in a subfile panel. For each source member, CHKCMP displays a brief message, which can have one of three values:
OKThe member compiled, and the objects timestamp is greater than the source members.
No objectThere is no object that corresponds to the source member.
Src is newerThere is an object, but its timestamp is older than the source members. This last case is particularly hard to determine manually, since the information is buried and hard to dig up.
CHKCMPs Parameters
CHKCMP has four parameters:
Source file (SRCFILE)Enter the qualified name of the source file you want to check. The library portion defaults to *LIBL if not given. You can also specify *CURLIB or a specific library name.
Source members (SRCMBR)Enter a beginning and an ending source member name into this mixed-list parameter. If either name is not given, CHKCMPs default
guarantees the widest possible range. That is to say, the beginning member defaults to *BEGIN (which is translated as all blanks), while the ending member defaults to *END (which is translated as all 9s).
Object library (OBJLIB)Enter the name of the library into which the objects should be compiled. CHKCMP defaults to *SRCFLIB if not given; with this value, CHKCMP assumes that the objects are in the same library as the source file.
Reuse list (REUSELIST)CHKCMP creates an outfile of all source members found in the source file identified in the SRCFILE parameter. Since this can take some time (depending on how many members there are), REUSELIST allows you to bypass this outfile generation by specifying REUSELIST(*YES). This comes in handy if you need to run CHKCMP repeatedly for several ranges of source members on the same source file. REUSELIST accepts either *YES or *NO. The default is *NO, which forces CHKCMP to rebuild the list of members.
Suppose, for instance, that you have uploaded a number of RPG programs to your clients AS/400. The source file is QRPGSRC in library R35ARS, and the member names all begin with ARIN. After compiling them to library R35OBJ, you can do the following:
CHKCMP SRCFILE(R35ARS/QRPGSRC) +
SRCMBR(ARIN ARIN999999) +
OBJLIB(R35OBJ)
You can then scan the status column visually; any errors are reported in red. For those members that display errors, you can even enter an option on the leftmost column (any character works fine) and press Enter; CHKCMP invokes the Work with Members using PDM (WRK-MBRPDM) command, thereby allowing you to edit and/or recompile the member, as you see fit. When done with PDM, you are returned to CHKCMPs panel. At this point, you can press F5 to refresh the subfile to see if your work in PDM solved the problem (keeping in mind that if you asked PDM to compile, you will have to wait until the compile finishes).
If later you need to do the same checking for all programs beginning with ARRP, you can enter the information as shown in Figure 1.
Notice the REUSELIST(*YES) parameter, specified to save time.
Improve on It
I have coded CHKCMP so that it accommodates source members of type CMD, CL, CLLE, CBL, CBLLE, RPG, RPGLE, PF, LF, DSPF, PRTF, and PNLGRP. If you use other member types (e.g., SQLRPG or ICFF), youll need to modify CHKCMPC1 accordingly. This way, youd have a CHKCMP tool that fits your environments unique needs. Also, CHKCMP makes use of the utility command Forward Program Messages (FWDPGMMSG), which was published in the January 1998 issue of MC (see How to Forward Messages in CL).
CHKCMP allows the user to ascertain that compilations were successful. Use this utility for Y2K testing or for any other work in which you need to be sure you have good source before you modify it.
CHKCMP SRCFILE(R35ARS/QRPGSRC) +
SRCMBR(ARRP ARRP999999) +
OBJLIB(R35OBJ) +
REUSELIST(*YES)
Figure 1: Examples of use
LATEST COMMENTS
MC Press Online