Here’s Some Good Advice!
With V4R5, IBM added several new advisors to the AS/400 Information Center Web site (www.as400.ibm.com/infocenter). Advisors provide a form of interactive help by asking you a series of questions and then either making a recommendation or pointing you to where you can get more information. The following advisors for V4R5 are now available:
• TCP/IP subnet calculator—This advisor helps you calculate new subnets of IP addresses for Class A, Class B, and Class C network addresses. You must know your network address before using this advisor. It can only subnet network addresses into equally sized subnets.
Just enter your network address and select the number of subnets you want. The advisor then calculates values for each subnetwork, including the subnetwork mask and broadcast addresses. This advisor is easy to use and saves you the pain of figuring out the addresses yourself. It’s also easy to go back and try different possibilities to see which one you really want.
• VPN planning—When you provide this advisor with information about your corporate network, it suggests what type of virtual private network (VPN) you should create for your business needs and what parameters are required to configure it. This advisor covers the most basic network configurations, so those with complex or unusual configurations should look for help in the VPN documentation. Otherwise, this advisor is a good starting point for configuring your VPN connection.
After you answer five to eight questions (depending on your configuration) about the local and remote networks, IP addresses, and security, the advisor provides you with a customized worksheet you can use to configure the VPN connection. There are step-by- step instructions to guide you through the configuration process. This advisor takes a complex planning process and cuts through the “fat” to deliver a powerful, timesaving tool.
• Logical partition planning—This advisor will ask you a series of questions and then create the Logical Partition Hardware Planning Worksheet for you. This worksheet will help you find out what hardware resources you need to create logical partitions on your AS/400. Your marketing representative or business partner can then use this information to configure the system you need.
The advisor walks you through the process of deciding what hardware you want in each partition. The process can be long, however, so set aside a few hours. Although it is easy
to go back and forward through this advisor, there is no way to jump around and make changes randomly. Look for an update to this advisor later this year that will be easier to use and more compatible with the Configuration Planning Worksheet currently available on IBM’s Logical Partitioning Web site (www.as400.ibm.com/lpar). This advisor is meant to help you complete the first section of the Configuration Planning Worksheet. It will prove to be very useful to those who want to get a rough idea of the hardware resource requirements needed for a business. It is not useful, at least at this point, for validating the hardware and the configuration. That job still belongs to your business partner or marketing representative, IBM Technology Solutions Center, and the Configurator tool.
• Logical partition troubleshooting—This advisor points you to information about error messages and system reference codes (SRCs) that relate to logical partitions. Although this advisor supports only messages and SRCs directly related to problems caused by the logical partitioning code or requirements, you can narrow down your problem by going here first. (If it is not found, the problem is probably not related to your logical partitions.)
You can access these advisors from the main navigation frame of the Information Center under the Advisors heading. You will also find links to each advisor in the main section of the Information Center. See my article “Getting to Know the New LPAR Worksheet” on page 47 for more information about the advisors and worksheets.
—Garrett Winn
User Spaces Made Easy
As of V4R4, the Edit File Utility (EDTF) in V4R4 can edit user spaces, in addition to source members and AS/400 Integrated File System (AS/400 IFS files). Just specify a path name to a user space as follows:
EDTF STMF(‘/qsys.lib/mylib.lib/myspace.
usrspc’)
If the user space doesn’t exist, EDTF will first create it and then let you edit it.
—Gene Gaunt Gene_Gaunt/
Data Loader Commands Enhanced
V4R4 PTFs have recently been made available that enhance the functionality of the DB2
UDB for AS/400 Copy from Import File (CPYFRMIMPF) and Copy to Import File (CPYTOIMPF) commands. One of the enhancements is a new Remove blank (RMVBLANK) parameter for CPYFRMIMPF. The values available for the RMVBLANK parameter are *LEADING and *NONE. If *LEADING is specified, DB2 UDB strips leading blanks from a character string before placing the resulting string in the specified target character column. With *NONE, all leading blanks are included in the result string that is copied into the specified target character column.
Another enhancement is a new Allow null values (ALWNULLVAL) parameter for CPYFRMIMPF. The values available for ALWNULLVAL are *NO and *FLDDFT. When *FLDDFT is specified, DB2 UDB assigns the default value to the target column if the data being imported (e.g., blanks in a numeric field) would cause DB2 UDB to try to place a null value in a target column that doesn’t allow nulls.
There is also a new Stream file code page (STMFCODPAG) parameter for CPYTOIMPF, which allows you to specify the code page of the target stream file. In the
past, you would have used another tool or command to first create the stream file with the desired code page to override the default behavior of the command.
Finally, there is a new behavior for the CPYTOIMPF MBROPT(*REPLACE) option. Now, when MBROPT(*REPLACE) is specified, DB2 UDB clears the target stream file if CPYTOIMPF is given an empty database table to copy.
The PTF numbers for V4R4 are SF61859 and SF61937.
—Kent Milligan PartnerWorld for Developers, AS/400
Automated Object Recompiling
Everyone has had to change a physical file in some way, shape, or form. (Y2K was a perfect example.) After changes are made to the physical file, the next step is to compile any logical files built over the physical file and any programs that use that physical file. Locating these programs is an easy enough procedure: Provided that all the programs are contained in one library, a simple scan of the source code using PDM accomplishes this. However, when you’ve used the physical file or the logical files attached to it in programs in other libraries throughout your system, locating these programs isn’t so easy.
One solution is to have a utility locate and list usages across all the libraries in your system. The Display Program References (DSPPGMREF) command makes this possible by creating an outfile that you can use to print a report of the information you need. A past submission by Eugene Arencibia (“TechTalk: What Programs Use a File?” MC, June
1992) addresses this problem, but it prints a report for only one file and only one library at a time. To overcome this limitation, I use a physical file to store the names of all application libraries (with program load members) on the system. All the library names are then processed using this physical file. There is also a “wild card” character (‘.’) for the last five to eight characters of the file name and an automated compilation routine for programs found. This wild card feature enables a run of the program to list associated physical and logical files together, provided that your naming conventions are set up accordingly. You can easily change this wild card feature if your files are named differently.
Using this system gives you an accurate picture of file usage by program in each library, thus giving you an up-to-date picture of all program references (CL and RPG) to a selected file. I’ve also included on the report the date of last use, so you can readily determine whether or not the program is being used. The List File Programs (LSTFPGM) command and its associated programs—F000CL, F001CL (Figure 1), F002CL (Figure 2, page 114), and F001RG—give you a solution to this problem with a concise listing of necessary information.
To use this utility, you must first create the physical file LIBRNAME before running the programs. Use your favorite file editor to enter the names of all the libraries on your system that contain compiled program objects. This is important because, if you try to process a library with no program object members, the program will halt and you will get a CPF2123 error. Once you have built the list of programs using the file(s) in question, you generally have to compile those programs to avoid level-check errors the next time you run them. (As long as I have the necessary information for compiling all the affected programs, I write a process to automate the compilations.)
Enter on a command line the command I created named COMPILE; it prompts you to enter the parameter value of either CL or RPG. As the program runs, you’ll see a display screen informing you that you are compiling programs using the xxxxxxxxxx file, where xxxxxxxxxx is the name of the changed files. You are allowed to change the source and/or object libraries in case you do not keep your compiled objects in the same library as your source members. Pressing F1 allows you to bypass compilation of a program. Pressing F3
ends the job as usual, but, in case you have to stop somewhere in the middle of the list, you can, when you resume compiling, pick up where you left off.
Each program name record is coded with an X in the PGSTAT field after a successful compilation. This code is checked and bypassed if it is not blank in the F0002RG program. If a fatal compilation error occurs, you will get a message on your screen informing you of the unsuccessful compilation. Note the name of the program for later correction, press F1 to bypass the program, and continue with the next compilation. When you get ready to use this utility, first run the LSTFPGM command and then run the COMPILE command to recompile all the programs and logical files used by the file you specified in LSTFPGM. All the source for this tip can be downloaded from the MC Web site at www.midrangecomputing.com/mc.
I put all the objects in the QGPL library so I can call LSTFPGM and COMPILE from any library whenever the need arises. One final note: As written, this utility supports only Original Program Model (OPM) programs, but you can easily modify it to support RPG IV and CLLE programs as well.
—Roger Stein
Improving on CRTDUPOBJ
Create Duplicate Object (CRTDUPOBJ) is a powerful tool, but it has three handicaps:
• It does not support the library list.
• It does not support qualified object names.
• It fails if the new object already exists.
I created the CPYOBJ (Copy Object) utility to address these limitations. CPYOBJ consists of two objects: a CL program, CPYOBJC, and a command definition, which has the following four parameters:
• OBJ identifies the object or objects being copied. You can enter a specific or generic object name, and the library portion can be either *LIBL or a given library name.
• OBJTYPE identifies the type of object being copied. You can enter *ALL if the copy request employs a generic name.
• NEWOBJ gives a name to the new object being created. The name defaults to *SAME, giving the new object the name of the original object. The library qualifier also defaults to *SAME for those cases in which you want to copy an object within a single library.
• REPLACE tells CPYOBJ what to do if an object to be created already exists in the target library. With *NO (the default value), CPYOBJ fails if the target object already exists. With *YES, CPYOBJ deletes the target object before attempting the copy process.
You should know a few things about the CPYOBJ utility. First, because it executes CRTDUPOBJ internally, CPYOBJ shares that command’s limitations. Second, if you use REPLACE(*YES) when copying a physical file, CPYOBJ will fail to delete the existing target file if the file has any logical files attached. Third, CPYOBJ does not copy the data in database files. Last, CPYOBJ uses the Forward Program Messages (FWDPGMMSG) utility command, which I wrote and published in “How to Forward Messages in CL” (MC, January 1998). You can download the source code for the CPYOBJ utility from the MC Web site at www.midrangecomputing.com/mc.
—Ernie Malaga Computer Solutions, Inc.
/***************************************************************/
/* To Compile: */
/* */
/* CRTCLPGM PGM(XXXX/F001CL) SRCFILE(XXX/QCLSRC) + */
/* SRCMBR(F001CL) */
/* */
/* */
/***************************************************************/
PGM PARM(&FILE)
DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
DCL VAR(&DATAF1) TYPE(*CHAR) LEN(1)
CLRPFM PROGRMNM
/* CLEAR QADSPOBJ IF PRESENT */ CHGVAR VAR(&DATAF1) VALUE('Y')
CHKOBJ (QTEMP/QADSPOBJ) (*FILE)
MONMSG MSGID(CPF9801) EXEC(CHGVAR VAR(&DATAF1) +
VALUE('N'))
IF COND(&DATAF1 *EQ 'Y') THEN(DO)
CLRPFM QTEMP/QADSPOBJ
ENDDO
/* CLEAR QADSPPGM IF PRESENT */ CHGVAR VAR(&DATAF1) VALUE('Y')
CHKOBJ (QTEMP/QADSPPGM) (*FILE)
MONMSG MSGID(CPF9801) EXEC(CHGVAR VAR(&DATAF1) +
VALUE('N'))
IF COND(&DATAF1 *EQ 'Y') THEN(DO)
CLRPFM QTEMP/QADSPPGM
ENDDO
CHGDTAARA DTAARA(*LDA (501 10)) VALUE(' ')
REPEAT:
/* READ LIBRARY NAME RECORD, SKIP TO PRINT PROGRAM IF BLANK */ CALL PGM(F000RG)
CHGVAR VAR(&PGMLIB) VALUE(%SST(*LDA 501 10))
IF COND(&PGMLIB *EQ ' ') THEN(DO)
GOTO ENDLOOP
ENDDO
/* CLEAR QADSPOBJ */ CHGVAR VAR(&DATAF1) VALUE('Y')
CHKOBJ (QTEMP/QADSPOBJ) (*FILE)
MONMSG MSGID(CPF9801) EXEC(CHGVAR VAR(&DATAF1) +
VALUE('N'))
IF COND(&DATAF1 *EQ 'Y') THEN(DO)
CLRPFM QTEMP/QADSPOBJ /* NEW */
ENDDO
/* CALL F002CL TO PROCESS QADSPOBJ MEMBERS OF CURRENT LIBRARY */ DSPOBJD OBJ(&PGMLIB/*ALL) OBJTYPE(*PGM) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) +
OUTMBR(*FIRST *ADD)
OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ)
CALL F002CL (&PGMLIB &FILE)
MONMSG MSGID(CPF0864)
GOTO REPEAT
ENDLOOP:
OVRDBF FILE(QADSPPGM) TOFILE(QTEMP/QADSPPGM)
CALL PGM(F001RG) PARM(&FILE)
DLTOVR FILE(*ALL)
RETURN /***************************************************************/
/* To Compile: */
/* */
/* CRTCLPGM PGM(XXXX/F002CL) SRCFILE(XXX/QCLSRC) + */
/* SRCMBR(F002CL) */
/* */
/* */
/***************************************************************/
PGM PARM(&PGMLIB &FILE)
DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&FILE) TYPE(*CHAR) LEN(10)
Figure 1: CL program F001CL submits a list of program names to be compiled.
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(132)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCLF FILE(QADSPOBJ)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))
READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ERROR))
CHGVAR VAR(&ODLBNM) VALUE(&PGMLIB)
DSPPGMREF PGM(&ODLBNM/&ODOBNM) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/QADSPPGM) OUTMBR(*FIRST *ADD)
GOTO READ
ERROR: +
RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM
Figure 2: CL program F002CL builds a list of source members to be compiled.
LATEST COMMENTS
MC Press Online