TechTalk: Browse Source Command

System Administration
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Sometimes, I need to quickly browse a source member for a program, but I'm unable to recall the source file name that contains the source member. I solved this problem by creating the Display Source Member (DSPSRCMBR) command. DSPSRCMBR uses the Display Object Description (DSPOBJD) command to retrieve the source member's location from information found in the program object. The program then uses the browse mode in SEU to display the source member. The source code for DSPSRCMBR is shown in 5. The source code for the CPP, SRC013CL, is shown in 6.

Sometimes, I need to quickly browse a source member for a program, but I'm unable to recall the source file name that contains the source member. I solved this problem by creating the Display Source Member (DSPSRCMBR) command. DSPSRCMBR uses the Display Object Description (DSPOBJD) command to retrieve the source member's location from information found in the program object. The program then uses the browse mode in SEU to display the source member. The source code for DSPSRCMBR is shown in Figure 5. The source code for the CPP, SRC013CL, is shown in Figure 6.


TechTalk: Browse Source Command

Figure 5: DSPSRCMBR Command Source

 /*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/DSPSRCMBR) PGM(XXX/SRC013CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ DSPSRCMBR: CMD PROMPT('Display Source through SEU') PARM KWD(PROGRAM) TYPE(PROGRAM) MIN(1) + PROMPT('Program name') PROGRAM: QUAL TYPE(*NAME) LEN(10) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*LIBL) (*CURLIB)) PROMPT('Library') 
TechTalk: Browse Source Command

Figure 6: Command Processing Program SRC013CL Source

 /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SRC013CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ PGM PARM(&QUALOBJ) DCL VAR(&QUALOBJ) TYPE(*CHAR) LEN(20) DCL VAR(&OBJ) TYPE(*CHAR) LEN(10) DCL VAR(&OBJLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSG) TYPE(*CHAR) LEN(80) DCLF FILE(QADSPOBJ) MONMSG MSGID(CPF0000) CHGVAR VAR(&OBJ) VALUE(%SST(&QUALOBJ 1 10)) CHGVAR VAR(&OBJLIB) VALUE(%SST(&QUALOBJ 11 10)) DSPOBJD OBJ(&OBJLIB/&OBJ) OBJTYPE(*PGM) + DETAIL(*SERVICE) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/QADSPOBJ) MONMSG MSGID(CPF2105) EXEC(DO) CHGVAR VAR(&MSG) VALUE('Object' *BCAT &OBJ *BCAT + 'in library' *BCAT &OBJLIB *BCAT 'not + found or is not a program.') SNDPGMMSG MSG(&MSG) RETURN ENDDO MONMSG MSGID(CPF2110) EXEC(DO) CHGVAR VAR(&MSG) VALUE('Library' *BCAT &OBJLIB + *BCAT 'not found or invalid') SNDPGMMSG MSG(&MSG) RETURN ENDDO MONMSG MSGID(CPF9860) EXEC(DO) CHGVAR VAR(&MSG) VALUE('Object' *BCAT &OBJ *BCAT + 'in library' *BCAT &OBJLIB *BCAT 'is in + use at the moment - cannot retrieve.') SNDPGMMSG MSG(&MSG) RETURN ENDDO OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/QADSPOBJ) RCVF STRSEU SRCFILE(&ODSRCL/&ODSRCF) SRCMBR(&ODSRCM) + OPTION(5) MONMSG MSGID(EDT0000) EXEC(DO) CHGVAR VAR(&MSG) VALUE('Source for' *BCAT &OBJLIB + *TCAT '/' *CAT &OBJ *BCAT 'not found.') ENDDO DLTOVR FILE(*ALL) CLOF OPNID(QADSPOBJ) ENDPGM: ENDPGM 
BLOG COMMENTS POWERED BY DISQUS