In response to a recent tip from the System i community about the XCPYSPLF command's potential for e-mail delivery, iSeries programmers and IT staff flooded the Search400.com mailboxes with follow-up questions, code modifications and more System i tips.
Below are a sample of the iSeries document management tips we received. More will follow. You can always submit a tip using the site's form or e-mail the editor directly if you have comments or feedback. Thanks to everyone who sent their document management how-to's and suggestions.
Access Word docs from Help in RPGILE
At NPE I like the ability to do documentation in Word and be able to access it directly from a Help request in an RPGILE program.
All you need is a shared folder under the Home directory. I called the folder DOCUMENTATION. I create my documentation in Word and save it to this folder. For printing reasons we use Adobe to make it into a PDF file. By calling this small CL program you have the documentation being displayed in Adobe and when you exit it returns you to the iSeries screen. (Where ever you have your help key response within the RPGILE program you place the call to something similar to this CL program. If the file being accessed is .doc then it will show in Word. If the extension is .csv then it will show in Excel.
I have placed all 9's for our port address to the iSeries, and we use the port address to avoid domain name conflicts. I use the name of the RPGILE program with the PDF extension to keep my documentation matched and easy to track.
1.00 PGM 080109
2.00 STRPCO 080109
3.00 MONMSG MSGID(IWS4010) 080109
5.00 STRPCCMD PCCMD('//99.9.9.99/HOME\DOCUMENTATION\DH1000.PDF') 080131
6.00 ENDPGM 080109
Keith Green
NPE, Inc.
I-Series Systems Analyst
Copy queued docs to your AS/400
When we have a need to e-mail documents, I set up a special out queue that is not attached to a printer. If anything is moved to this out queue, it will be automatically copied to a folder on the AS/400 so the users can access it. The code below is the job that checks the out queue and copies documents to the folder. I can see where using the XCPYSPLF might be better or can be used in combination with this methods.
PGM
DCL VAR(&DATETIME) TYPE(*CHAR) LEN(20)
DCL VAR(&FILENAME) TYPE(*CHAR) LEN(20)
DCL VAR(&COUNT) TYPE(*CHAR) LEN(6)
DCL VAR(&NCOUNT) TYPE(*DEC) LEN(6)
DCL VAR(&HHMM) TYPE(*CHAR) LEN(6)
DCL VAR(&DAYWEEK) TYPE(*CHAR) LEN(4)
DCL VAR(&HH) TYPE(*CHAR) LEN(2)
DCL VAR(&MM) TYPE(*CHAR) LEN(2)
DCL VAR(&NMM) TYPE(*DEC) LEN(2 0)
DCL VAR(&NHH) TYPE(*DEC) LEN(2 0)
DCL VAR(&ADD) TYPE(*CHAR) LEN(4)
DCL VAR(&SSNUM) TYPE(*DEC) LEN(4 0)
DCLF FILE(OUTFILE)
/*FIRST DETERMINE IF THERE ARE ANY REPORTS IN THE OUTQ */
WRKOUTQ OUTQ(EMAIL) OUTPUT(*PRINT)
CPYSPLF FILE(QPRTSPLQ) TOFILE(OUTQFILE)
RUNQRY QRY(OUTQFILE)
DLTSPLF FILE(QPRTSPLQ)
/*READ THE FILE CREATED BY OUTQFILE QUERY */
LOOP: RCVF
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END))
/*COPY THE SPOOLFILE TO A FILE THAT CAN BE COPIED TO A PC FOLDER */
CHGVAR VAR(&SSNUM) VALUE(&SNUM)
CPYSPLF FILE(&NAME) TOFILE(SPOOLFILE) +
JOB(&NUM/&USER/&JOB) SPLNBR(&SSNUM)
/*CREATE THE FILE NAME USING A COUNTER SO THAT IT WILL BE UNIQUE */
RTVDTAARA DTAARA(EMAILCNT (1 6)) RTNVAR(&COUNT)
CHGVAR VAR(&NCOUNT) VALUE(&COUNT)
IF COND(&NCOUNT *GT 999990) THEN(CHGVAR +
VAR(&NCOUNT) VALUE(0))
CHGVAR VAR(&NCOUNT) VALUE(&NCOUNT + 1)
CHGVAR VAR(&COUNT) VALUE(&NCOUNT)
CHGDTAARA DTAARA(EMAILCNT) VALUE(&COUNT)
CHGVAR VAR(&FILENAME) VALUE('RP' *CAT &COUNT *CAT +
'.DOC')
CPYTOPCD FROMFILE(SPOOLFILE) TOFLR(EMAILRPT) +
TODOC(&FILENAME) REPLACE(*YES)
/*DELETE THE SPOOL FILE GENEREATED */
DLTSPLF FILE(&NAME) JOB(&NUM/&USER/&JOB) SPLNBR(&SSNUM)
...+... 1 ...+... 2 ...+... 3 ...+.
GOTO LOOP
END:
STOP:
ENDPGM
Pattie N. Clayton
Information Technology
City of Danville
A handy comment line eases prototype woes
When creating a procedure prototype and interface for the main program to replace the *ENTRY PLIST, I add a comment line that includes the word "*ENTRY" so that someone searching can find it more easily.
*******************************************************************************************
* *ENTRY Prototypes
*******************************************************************************************
d otr069 pr
d pOrder 7a
d pLine 4a
d otr069 pi
d pOrder 7a
d pLine 4a
Kevin C. Ketzler
Affiliated