Submitted by Anonymous (not verified) on Thu, 05/17/2007 - 00:00
Forums

How can I save a spool file on one AS/400, send It by E-mail for printing on another AS/400? (Without InterForm400)

Full name
Administrator

admin

Thu, 05/17/2007 - 00:00

**************************************************************************************************************************
WARNING! THE PROCEDURE DESCRIBED BELOW WORKS FINE IN VERSIONS UP TO V5R3M0 OF OS400. BUT IBM HAS ANNOUNCED, THAT SUPPORT FOR
QSPGETF AND QSPPUTF WILL STOP WITH THE NEXT RELEASE OF OS400. SO THIS PROCEDURE SHOULD ONLY BE USED FOR AD-HOC SAVE/RESTORE PROCEDURES!
***************************************************************************************************************************

First you should find the identification of the spooled file. From the list of spooled files seen with WRKOUTQ you can press F11 in order to find:

Spooled file name
Spooled file number
Job number
Userprofile
Job number

From this example screen:
----------------------------------------------------------------------------------
Work with Output Queue

Queue: KSE Library: KSE Status: RLS

Type options, press Enter.
1=Send 2=Change 3=Hold 4=Delete 5=Display 6=Release 7=Messages
8=Attributes 9=Work with printing status

Opt File File Nbr Job User Number Date Time
APF3812 5 QPADEV000B KSE 059633 04/29/04 15:41:02
---------------------------------------------------------------------------------
You will find, that the values in the example are:
Spooled file name: APF3812
Spooled file number: 5
Job name: QPADEV000B
User profile: KSE
Job number: 059633


You can call QSPGETF to save a spooled file like below.

CALL PGM(QSYS/QSPGETF) PARM('SPLFNAME ' 'FILENAME LIBRARY ' 'JOBNAME USERNAME JOBNBR' X'00000001' 'MBRNAME ')

Here you should insert the fields:
'spooled file name' in FILENAME
A new DB file FILENAME (will automatically be created)
The library of the file in LIBRARY
The 'Job name' in JOBNAME
The User profile in USERNAME
The 'Job number' in JOBNBR
The hex value of the spooled file number written in X'00000001' (for numbers lower than 10 the hex number is the the same as the decimal representation of the number).
A member name for the DB file in MBRNAME

Please note: You must insert blanks to fill out the gab so that FILENAME, LIBRARY, JOBNAME, USERNAME and MBRNAME takes up 10 chars.

Given the example above the command would then be:

This dumps the spooled file in the member MEMBER1 in the file DUMPSPLF in the library QTEMP.

In order to get the file down to a PC you should create a temporary save file:
CRTSAVF FILE(QGPL/DUMPSPLS)

Next you save the file into the save file with this command:

SAVOBJ OBJ(DUMPSPLF) LIB(QTEMP) DEV(*SAVF) SAVF(QGPL/DUMPSPLS)

Now you should FTP the save file onto your PC (remember to use BINARY) and e-mail it.

If however you are not able to FTP the file you should look for another Q&A on this site that can help you with that.

When you have transfered the file to your PC you can delete the temporary files:
DLTF FILE(QGPL/DUMPSPLS)

The temporary file in QTEMP will automatically be deleted when you sign off.

*** RESTORE with QSPPUTF ****
When you want to restore the spooled file (that has been saved with QSPGETF) on the receiving iSeries, you start by creating a save file:
CRTSAVF FILE(QGPL/DUMPSPLS)

Next FTP the file into the save file using BINARY.

Then you restore the physical file containing the spooled file with this command:

RSTOBJ OBJ(DUMPSPLF) SAVLIB(QGPL) DEV(*SAVF) SAVF(QGPL/DUMPSPLS)

An then you can restore the spooled file with this command:

CALL PGM(QSPPUTF) PARM('DUMPSPLF QTEMP ' 'OUTQ OUTQLIB ' 'MEMBER1 ')

So here you state 3 parameters:
The first contains the physical file, that we want to restore from. It is written as the name of the file followed by the library where it is placed.

The second contains the output queue, that you want to restore to followed by the library of the outq.

The third and last parameter contains the member, that you want to restore from.

Remember to insert blanks to fill out 10 characters for each information like below:

Finally you can delete the temporary save file:

DLTF FILE(QGPL/DUMPSPLS)


--------------------------------- Alternative way to save an *SCS spooled file ----------------------------------------------

On your AS/400 machine, create a physical file like this:

CRTPF FILE(QTEMP/QAZ) RCDLEN(202) MAXMBRS(*NOMAX) SIZE(*NOMAX)

CPYSPLF FILE(QPRINT) TOFILE(QTEMP/QAZ) JOB(002572/QSECOFR/DSP01)
SPLNBR(2) CTLCHAR(*FCFC)

NB: You can verify the attributes by looking in the spool file description
using option 8 on the WRKOUTQ screen.

CPYTOPCD FROMFILE(QTEMP/QAZ) TOFLR(XXXX) FROMMBR(*FIRST) TODOC(PRINT)
REPLACE(*YES) TRNTBL(*NONE) TRNFMT(*NOTEXT)

Now attach the file PRINT from the folder XXXX to an E-mail.

 

On the receiving machine save the file in a folder e.g. YYYY and I do the following:

CRTPF FILE(QTEMP/QAZ) RCDLEN(202) MAXMBRS(*NOMAX) SIZE(*NOMAX)

CPYFRMPCD FROMFLR(YYYY) TOFILE(QTEMP/QAZ) FROMDOC(PRINT) TRNTBL
(*NONE) TRNFMT(*NOTEXT)

OVRPRTF FILE(QPRINT) CTLCHAR(*FCFC) OUTQ(QUSRSYS/PRT01)

CPYF FROMFILE(QTEMP/QAZ) TOFILE(QPRINT)


It would be convenient to save and send the print file used, and include it in the E-mail (QPRINT in this example).
Alternatively make screenshots of the attributes of the spool file on the output queue with selection 8=Display Description

NOTE: Always inform about the version of the AS/400 in the E-mail.