02
Sat, Nov
2 New Articles

TechTalk

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 This email address is being protected from spambots. You need JavaScript enabled to view it.

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/This email address is being protected from spambots. You need JavaScript enabled to view it.

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 This email address is being protected from spambots. You need JavaScript enabled to view it.

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 This email address is being protected from spambots. You need JavaScript enabled to view it.

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. This email address is being protected from spambots. You need JavaScript enabled to view it.

/***************************************************************/

/* 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.


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: