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.

4 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.

Jahid Hasan said...

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent
GSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows versions from widows XP/ 2003 and later.
Go To:>> http://www.gurusquad.com/GSCOPYPRO