Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Copy and restore spoolfiles

Check out this tip to see what to do to prevent an error message when you copy a spoolfile using the CPYSPLF command.

You Can View User Feedback To This Tip

Have you ever tried to copy iSeries 400 spool files using the CPYSPLF command and received message: CPA3311 'Attributes of file xxxxxx are not supported'?

The CPYSPLF command works well for text-based spoolfiles, and by using some formatting options can even restore print spacing if needed. However, if you are using spoolfiles that are not text only, or you have had trouble restoring print files back to their original format, maybe you need to use GETSPLF and PUTSPLF.

The preferred method for duplicating spooled files with extra attributes is using OS/400 programs, QSPGETF and QSPPUTF, to copy a spooled file to a physical file, and later back to a specified Output Queue. The QSPGETF, and QSPPUTF programs are part of OS/400. To use them, you only need to know and pass in the required program parameters. In order to make them easier to use, I have written a command to call these two IBM programs. The commands are GETSPLF and PUTSPLF.

In order to use these, you must first create a multiple member Physical File with a length of 4083 bytes. Use the GETSPLF command, and specify the spoolfile to copy based on: Spooled file name, Spool Job Name, User, Number and Spoolfile number. Then specify the Physical File name, library, and member name to copy to.

To restore the spoolfile, use the PUTSPLF command. This requires the From Lib/Filename, member name, and what output queue to create the spoolfile in.

Before running these programs, you will have to insure that the user running the program has authority to the QSPGETF, and QSPPUTF programs. I believe that they are shipped with OS/400 as PUBLIC *EXCLUDE


 

         /* **************************** */
         /*  GETSPLF - Get Spooled File  */
         /*                              */
         /*  Program to Process: QSPGETF */
         /* **************************** */
         CMD     PROMPT('Get Spooled File')
         PARM    KWD(FILE) TYPE(*NAME) LEN(10) MIN(1) +
                   EXPR(*YES) PROMPT('Spooled file name' 1)
         PARM    KWD(TOFILE) TYPE(TOFILE) PROMPT('To data +
                   base file' 4)
TOFILE:  QUAL    TYPE(*NAME) LEN(10) DFT(SPLFOUTF) +
                   SPCVAL((SPLFOUTF)) EXPR(*YES)
         QUAL    TYPE(*NAME) LEN(10) DFT(QTEMP) +
                   SPCVAL((*LIBL) (*CURLIB) (QTEMP)) +
                   EXPR(*YES) PROMPT('Library')
         PARM    KWD(JOB) TYPE(JOB) DFT(*) SNGVAL((*)) +
                   PROMPT('Job name' 2)
JOB:     QUAL    TYPE(*NAME) LEN(10) EXPR(*YES)
         QUAL    TYPE(*NAME) LEN(10) EXPR(*YES) PROMPT('User')
         QUAL    TYPE(*CHAR) LEN(6) RANGE(000000 999999) +
                   EXPR(*YES) PROMPT('Number')
         PARM    KWD(SPLNBR) TYPE(*INT2) DFT(*LAST) +
                   SPCVAL((*ONLY 0) (*LAST -1)) +
                   PROMPT('Spooled file number' 3)
         PARM    KWD(TOMBR) TYPE(*NAME) LEN(10) DFT(SPLFOUTF) +
                   SPCVAL((*FIRST)(SPLFOUTF)) EXPR(*YES) +
                   PROMPT('To member' 5)





/* **************************** */
           	/*  PUTSPLF - Put Spooled File  */
           	/*                              */
           	/*  Program to Process: QSPPUTF */
           	/* **************************** */

           CMD     PROMPT('Put Spooled File')
           PARM    KWD(FROMFILE) TYPE(FROMFILE) MIN(1) +
                     PROMPT('From data base file' 2)
FROMFILE:  QUAL    TYPE(*NAME) LEN(10) SPCVAL((SPLFOUTF)) +
                     MIN(1) EXPR(*YES)
           QUAL    TYPE(*NAME) LEN(10) DFT(*LIBL) +
                     SPCVAL((*LIBL) (*CURLIB) (QTEMP)) +
                     EXPR(*YES) PROMPT('Library')
           PARM    KWD(OUTQ) TYPE(OUTQ) MIN(1) PROMPT('To +
                     output queue' 1)
OUTQ:      QUAL    TYPE(*NAME) LEN(10) MIN(1) EXPR(*YES)
           QUAL    TYPE(*NAME) LEN(10) DFT(*LIBL) +
                     SPCVAL((*LIBL) (*CURLIB)) EXPR(*YES) +
                     PROMPT('Library')
           PARM    KWD(FROMMBR) TYPE(*NAME) LEN(10) DFT(*FIRST) +
                     SPCVAL((*FIRST) (*LAST)) EXPR(*YES) +
                     PROMPT('From member' 3) 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

USER FEEDBACK TO THIS TIP

  • I tried this tip and the command didn't work. I always got an error. "File XF175A not found in job 303328/RICHARDC/Z04FX3111". Using same parameters (file/job/user/job number/spl file number) in CPYSPLF command works fine so the file does exist. I came across the answer. The code in the tip doesn't work under V5R1. IBM provides the correct code here. — Richard Corpuz

Dig Deeper on iSeries system performance and monitoring

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close