Spool to PF

15 pts.
Spool files
Is there any way to conver a spool file in a formated physical file with out any codeing. Thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

It is Possible to convert spool to a formatted physical file

First u ‘ll have to copy the spool file through this command CPYSPLF
to a flat file .

Then copy to comma seperated file through CPYTOIMPF command
It will create a flat file with comma seperated fileds

Then u can create a physical file by copying them to a physical file through


Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Sloopy
    Reshma, Since the flat file created using CPYSPLF only has one field, creating a CSV file will create a file which itself only has one CSV field - it will look exactly the same. Pramod - could you give us more detail about what you are trying to achieve? Generally, a spooled file contains quite a lot of unwanted information, like headers and footers. The actual data portion of the file may be arranged in columns, but no simple command like CPYSPLF or CPYTOPCD or CPYTOIMPF knows about those columns. If your output is from an IBM-supplied utility, like DSPFFD, you can specify an output file on the command. This will give you what you want. But if the output is from a non-IBM application, it's unlikely that such an option will be available. If the application is your own, then you can change your programs to optionally create an output file in the correct form. But otherwise there is no easy way to create a DDS-style physical file from spooled file output unless you buy one of the third-party utilities designed for that job, or create a program that will specifically read the flat file from CPYSPLF and separate out the data in the way you design it to. Regards, Sloopy
    2,195 pointsBadges:
  • PramodPatel
    Thanks Reshma and Sloopy!!!! Actually i want to read a spool after completion of the job to get the byte/record transfered for successsful transmission.
    15 pointsBadges:
  • TG
    Hi PramodPatel, You can use the CPYSPLF as suggested, or if you have any iSeries Navigator you can directly copy it to PC or view it directly without need to signon to green screen. Br,
    50 pointsBadges:
  • Sloopy
    OK. To get the bytes/records transferred, you will use CPYSPLF to copy the spooled file into a single record physical file: CRTPF FILE(QTEMP/MYFILE) RCDLEN(150) CPYSPLF FILE(MYSPLF) TOFILE(QTEMP/MYFILE) JOB(000001/MYUSER/MYJOB) SPLNBR(*LAST) CALL MYPGM (If you add this code to the program that does the file transfer, then the job name parameter will be JOB(*), which makes things a lot easier.) The program MYPGM is your RPG program to read MYFILE and extract the information you want. So, if the spooled file contains lines like this: Records transferred . . . . : 1125 Bytes transferred . . . . . .. : 750110 - you are looking for the words 'Records transferred' and 'Bytes transferred', and whe you find them you know where the figures start and end, and can put them into variables and do what you want with them. It is possible that the command you use to do your file transfer may send a message back to the program that runs it, telling the program the number of records and/or bytes transferred. If that is the case (you would be able to see that in the job log), then you could add code to that program to receive the message and extract the values from the message data, which would be faster. Regards, Sloopy
    2,195 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: