How many times does someone call your help desk asking, "Where did my output go?" Here's a simple command and program that will help you answer that question.
The first thing you have to do is change your system value QAUDLVL to include *SPLFDTA. This will start journalling spooled file functions. Once this data starts collecting, you're ready to answer the user's question.
/********************************************************************/
/* */
/* Command name: UTUWHERE */
/* System name: Utility */
/* Author: Mary C. Milliron */
/* */
/* Command Narrative: */
/* */
/* This command will display journal entries for a user and */
/* display all the spool files that were printed for the user */
/* and where. */
/* */
/* Command Processing Program: */
/* */
/* UTJWHERE */
/* */
/********************************************************************/
UTUWHERE: CMD PROMPT('Where Did My Spool File Print?')
PARM KWD(USER) TYPE(*CHAR) LEN(10) MIN(1) +
PROMPT('User')
PARM KWD(DAYTE) TYPE(*CHAR) LEN(6) MIN(1) +
PROMPT('Date Output Created(mmddyy)')
/*********************************************************************/
/* */
/* Program name: UTJWHERE */
/* System name: Utility */
/* Author: Mary C. Milliron */
/* */
/* Program Narrative: */
/* */
/* This program will display the journal entries related to */
/* where user's spool files last printed. */
/* */
/* Compiler Options: */
/* */
/* Compile with QSECOFR authority. */
/* */
/*********************************************************************/
PGM PARM(&USER &DAYTE)
DCL VAR(&USER) TYPE(*CHAR) LEN(10)
DCL VAR(&DAYTE) TYPE(*CHAR) LEN(6)
CRTDUPOBJ OBJ(QAPTACG) FROMLIB(QSYS) OBJTYPE(*FILE) +
TOLIB(QTEMP) NEWOBJ(T2)
MONMSG MSGID(CPF0000) /* Just in case it's already +
there */
DSPJRN JRN(QACGJRN) RCVRNG(*CURCHAIN) +
FROMTIME(&DAYTE 000001) JRNCDE((A)) +
ENTTYP(SP) OUTPUT(*OUTFILE) +
OUTFILFMT(*TYPE1) OUTFILE(QTEMP/T2)
/* If you don't have Sequel from ASC, replace the following */
/* statement with a Query/400 query. You can even use a DSPPFM */
/* and scan thru the file. */
DISPLAY SQL('SELECT jadfn, jauser, +
zoned((SST(jadate,5,2) CAT +
SST(jadate,1,4)),6,0) edtcde(Y) +
name(dayte) colhdg("Entry" "Date"), +
jatime edtwrd(" : : "), jatpag, jadevn +
FROM qtemp/t2 WHERE jauser= "' || &USER +
|| '" order by dayte desc, jatime desc')
ENDIT: ENDPGM
This was first published in May 2001