|
Elonna, The spool file API's will correctly retain all the attributes of the spool file whereas CPYSPLF may not. Here's the code I use. Be aware that I have hard coded the size of VAR returned by the QUSRSPLA API to be equal to the length that the API returns which can be a problem if a new version increases this length. PGM (&SPLNAM &JOB &SPLFNO &TOQ) DCL &SPHND *CHAR 4 DCL &NWHND *CHAR 4 DCL &JOB *CHAR 26 DCL &JOBID *CHAR 16 DCL &SPLID *CHAR 16 DCL &SPLNAM *CHAR 10 DCL &SPLFNO *DEC 4 DCL &SPLNUM *CHAR 4 DCL &USIZE *CHAR 4 DCL &MINUS1 *CHAR 4 DCL &ERR *CHAR 14 DCL &VAR *CHAR 3816 DCL &SPACE *CHAR 20 'SPGETSP QTEMP' DCL &LEN *CHAR 4 DCL &TOQ *CHAR 20 DCL &SPCLIB *CHAR 10 DCL &CHGSPC *CHAR 16 /* BINARY CONVERSION */ CHGVAR %BIN(&SPLNUM) &SPLFNO CHGVAR %BIN(&MINUS1) -1 /* OPEN SPOOL FILE */ CHGVAR &ERR X'0000000000000000000000000000' CALL QSPOPNSP (&SPHND &JOB &JOBID &SPLID &SPLNAM &SPLNUM &MINUS1 &ERR) /* RETRIEVE SPOOL FILE ATTRIBUTES */ CHGVAR %BIN(&LEN) 3816 CALL QUSRSPLA (&VAR &LEN 'SPLA0200' &JOB &JOBID &SPLID &SPLNAM &MINUS1) CHKOBJ OBJ(QTEMP/SPGETSP) OBJTYPE(*USRSPC) MONMSG MSGID(CPF9801) EXEC(DO) /* CREATE USER SPACE */ CHGVAR %BIN(&USIZE) 500 CHGVAR &ERR X'0000000000000000000000000000' CALL PGM(QUSCRTUS) PARM(&SPACE SPLF &USIZE X'00' + '*ALL' 'User space for retrieving spool + files' '*YES' &ERR) ENDDO /* CHANGE SIZE OF SPACE TO 500 BYTES */ CHGVAR &CHGSPC X'000000010000000100000004000001F4' CHGVAR &ERR X'0000000000000000000000000000' CALL QUSCUSAT (&SPCLIB &SPACE &CHGSPC &ERR) /* RETRIEVE SPOOL FILE DATA INTO USER SPACE */ CHGVAR &ERR X'0000000000000000000000000000' CALL QSPGETSP (&SPHND &SPACE 'SPFR0200' &MINUS1 '*ERROR ' &ERR) /* CREATE NEW EMPTY SPOOL FILE */ CHGVAR &ERR X'0000000000000000000000000000' IF (&TOQ *NE '*SAME') + CHGVAR %SST(&VAR 191 20) &TOQ CALL QSPCRTSP (&NWHND &VAR &ERR) /* WRITE NEW SPOOL FILE DATA FROM USER SPACE */ CHGVAR &ERR X'0000000000000000000000000000' CALL QSPPUTSP (&NWHND &SPACE &ERR) /* CLOSE ORIGINAL SPOOL FILE */ CHGVAR &ERR X'0000000000000000000000000000' CALL QSPCLOSP (&SPHND &ERR) /* CLOSE NEW SPOOL FILE */ CALL QSPCLOSP (&NWHND &ERR) ENDPGM Cheers, Peter -----Original Message----- From: EThompson@uafc.com [mailto:EThompson@uafc.com] Sent: Tuesday, February 12, 2002 5:23 AM To: rpg400-l@midrange.com Subject: Copy Spool File Is there a way to copy a spool file to another spool file? I know a spool file can be copied into a physical file, but I would lose images, etc. TYIA Elonna Thompson Worldnet Services Corp Information Technologies 850-432-1700 x2204 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. This communication is confidential and may be legally privileged. If it is not addressed to you, you are on notice of its status. Please immediately contact us at our cost and destroy it. Please do not use, disclose, copy, distribute or retain any of it without our authority - to do so could be a breach of confidence. Thank you for your co-operation. If you need assistance, please contact Baycorp Advantage on either :- Australia (Toll Free) 133124 or New Zealand +64 9 356 5800
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.