IBM gave us the Dis-play Program Refer-ences (DSPPGMREF) command as a way to list the files used by a given program, or by all programs in a library. This command could be used more effectively if it worked the other way around: listing the programs that use a specific file. Turning DSPPGMREF around would make life so much easier, since you would be able to tell which programs to recompile after you change a file.
Fortunately, you can run DSPPGMREF to an outfile and use the outfile to print a report that contains only the information you need. I created the List File Programs (LSTFPGM) command (1a) and its associated programs, F001CL (1b) and F001RG (1d) to solve this common problem. The utility uses an externally-described printer file, F001P1 (1c).
Fortunately, you can run DSPPGMREF to an outfile and use the outfile to print a report that contains only the information you need. I created the List File Programs (LSTFPGM) command (Figure 1a) and its associated programs, F001CL (Figure 1b) and F001RG (Figure 1d) to solve this common problem. The utility uses an externally-described printer file, F001P1 (Figure 1c).
TechTalk: What Programs Use a File?
Figure 1A Command LSTFPGM
LSTFPGM: CMD PROMPT('List File Programs') PARM KWD(PGMLIB) TYPE(*NAME) LEN(10) + SPCVAL((*ALL) (*ALLUSR) (*CURLIB) (*LIBL) + (*USRLIBL)) MIN(1) EXPR(*YES) + PROMPT('Program library') PARM KWD(FILE) TYPE(*NAME) LEN(10) MIN(1) + EXPR(*YES) PROMPT('File name')
TechTalk: What Programs Use a File?
Figure 1B CL program F001CL
F001CL: + PGM PARM(&PGMLIB &FILE) DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10) DCL VAR(&FILE) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(132) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCLF FILE(QADSPOBJ) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) DSPOBJD OBJ(&PGMLIB/*ALL) OBJTYPE(*PGM) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/QADSPOBJ) OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ) READ: + RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDLOOP)) DSPPGMREF PGM(&ODLBNM/&ODOBNM) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/QADSPPGM) OUTMBR(*FIRST *ADD) GOTO CMDLBL(READ) ENDLOOP: + OVRDBF FILE(QADSPPGM) TOFILE(QTEMP/QADSPPGM) CALL PGM(F001RG) PARM(&FILE) DLTOVR FILE(*ALL) RETURN ERROR: + RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + MSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) ENDPGM
TechTalk: What Programs Use a File?
Figure 1C Printer file F001P1
A REF(QADSPPGM) A R HEADER SKIPB(3) A 2TIME A 55'List File Programs' A +30DATE EDTCDE(Y) A SPACEA(3) A 3'File' A +15'Library' A +7'Program' A +9'Usage' A SPACEA(2) * A R DETAIL SPACEA(1) A WHFNAM R 3 A WHLIB R +8 A WHPNAM R +4 A USAGE 12A +6
TechTalk: What Programs Use a File?
Figure 1D RPG program F001RG
FQADSPPGMIP E DISK FF001P1 O E 99 PRINTER * C WHFNAM IFEQ FILE C SELEC C WHFUSG WHEQ 1 C MOVEL'Input' USAGE C WHFUSG WHEQ 2 C MOVEL'Output' USAGE C WHFUSG WHEQ 3 C WHFUSG OREQ 4 C MOVEL'Update' USAGE C OTHER C MOVE *BLANK USAGE C ENDSL C *IN99 IFEQ *ON C WRITEHEADER C MOVE *OFF *IN99 C ENDIF C WRITEDETAIL C ENDIF * C *INZSR BEGSR C *ENTRY PLIST C PARM FILE 10 C WRITEHEADER C ENDSR
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online