5/5/08 Copy contents of spool file to a flat file

Step 1:
Create a flat file that has a record length of 132 (most spool files have a width of 132).

CRTPF FILE(FLATFILE) RCDLEN(132)

Step 2: Copy the spool file to the newly created flat file.

CPYSPLF FILE(QPDSPAJB) TOFILE(FLATFILE) JOB(*) SPLNBR(1)

Step 3: Copy the file to the IFS.

CPYTOSTMF FROMMBR('/qsys.lib/library.lib/flatfile.file/flatfile.mbr') TOSTMF('/somewhereintheifs/spoolfile.txt')



Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation. All other brands are property of their respective registered owners.

3 comments:

PeteM said...

Why would you use 132 and not 133 when the spool file is 132. If you use 133 then you keep all the control characters so not to loose the line and form spacing (forms control).

Pete

Vision Solutions said...

Thanks for your question. The Vision technician who contributed this tip will be contacted for his response and the answer will be posted here shortly.

Vision Solutions said...

The intention of this tip was to provide a quick way to get the data from the spool file into a spreadsheet or something similar. It is worth keeping in mind that on some systems, even easier options (like drag and drop via OpsNav) are available to do the same thing.

Apologies for the delay in posting a response to this question.