Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a File from a Spool file to capture Data

Status
Not open for further replies.

350ztn

MIS
Nov 19, 2003
96
US
I've been away from an As400 for about 4yrs. But what I need is a confirmation that the following can be done. I need to take a spool file and instead of printing it make it a file that can be pulled into a database and then indexed. I think I can just use ODBC to move the physical file from the 400 to the database, but the code from taking a spool file to a file that is 'indexable' (not a real word) is what I need to do. Will this code do it?

...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+
NEWFLDSUB: PGM

DCL VAR(&DOC) TYPE(*CHAR) LEN(8)
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
RTVJOBA USER(&USER)

CHGVAR VAR(&DOC) VALUE(%SST(&USER 1 8) +
*TCAT '.TXT')

CRTPF FILE(QTEMP/TEMPFL) RCDLEN(150)
CPYSPLF FILE(YOURSPLF) TOFILE(QTEMP/TEMPFL) +
SPLNBR(*LAST) CTLCHAR(*FCFC)


ENDCLP: ENDPGM
 
350ztn,

That will work but you might want to reconcider using QTEMP. Your file will go away when the job ends. If that's what you want then what you have is fine.

HTH,
MdnghtPgmr
 
In addition to what MdnghtPgmr said, you only have to make the physical file 1 byte longer than the spool file (for the control code, so it's 133 for 132 byte spool files).

Feles mala! Cur cista non uteris? Stramentum novum in ea posui!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top