OS/400 programmers are familiar with CL's Copy Spool File (CPYSPLF) command, which copies spooled output to a database file. As of V5R3, Qshell includes a utility that is similar in function. Its name is catsplf, and it will be a welcome addition when my shop goes live with V5R3.
Catsplf is similar in function to the cat utility, which reads standard input (stdin) or disk files. Catsplf reads one or more spool files from a job and writes them to standard output (stdout). You may specify the job in one of two ways. Use the j option to specify the qualified job name using the OS/400 convention of jobnumber/user/jobname. Use the p option to specify the job name by its Qshell process ID. Whichever method you use, follow the job name with the name and number of the spool file. The spool file name and alpha portions of the job name are not case-sensitive, so you may use your preference of uppercase or lowercase letters. You may not use either the special values *ONLY and *LAST that CPYSPLF supports to specify the spool file number, or the special value * to indicate the current job.
The following examples illustrate both of these options. In both cases, the first spool file named QSYSPRT is copied to stdout.
catsplf -p 854 QSYSPRT 1
There are three other options that can be useful.
The a option tells Qshell to read all the spool files for a job. In this case, you do not follow the job identifier with a spool file name and number. Here are two equivalent expressions that use the a option:
catsplf -aj 208922/PAMSDEN/QZSHCHLD
The e and n options number the lines as they are written to stdout. The difference between the two is that the e option ends each line with a dollar sign ($). Here are a couple of examples that use the e and n options:
catsplf -a -e -j 208922/PAMSDEN/QZSHCHLD
For more information about the catsplf utility, see IBM's iSeries Infocenter. To learn more about Qshell, I recommend Qshell for iSeries by Ted Holt and Fred A. Kulack.
Paul Amsden has worked with AS/400 and iSeries systems for more than 10 years.
LATEST COMMENTS
MC Press Online