A simple tool to dump all source in a library
Created
January 21, 2014 22:21
-
-
Save MikeWills/8549674 to your computer and use it in GitHub Desktop.
A simple tool to dump all source in a library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FDSPFDP IF E DISK | |
C eval *inlr = *on | |
C read QWHFDML | |
C dow (not %eof) | |
C callList plist | |
C parm mlLib | |
C parm mlFile | |
C parm mlName | |
C parm mlSeu2 | |
C CALL 'SVNDMPSRC' callList | |
C read QWHFDML | |
C enddo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PGM PARM(&LIB) | |
DCL VAR(&LIB) TYPE(*CHAR) LEN(10) | |
ADDLIBLE LIB(MWLIBR) | |
MONMSG MSGID(CPF0000) | |
DSPFD FILE(&LIB/Q*) TYPE(*MBRLIST) OUTPUT(*OUTFILE) FILEATR(*PF) + | |
OUTFILE(MWLIBR/DSPFDP) | |
CALL PGM(DMPALLSRC) | |
ENDPGM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PGM PARM(&LIB &FILE &MEMBER &TYPEIN) | |
/* Parameters */ | |
DCL VAR(&LIB) TYPE(*CHAR) LEN(10) | |
DCL VAR(&FILE) TYPE(*CHAR) LEN(10) | |
DCL VAR(&MEMBER) TYPE(*CHAR) LEN(10) | |
DCL VAR(&TYPEIN) TYPE(*CHAR) LEN(10) | |
DCL VAR(&TYPE) TYPE(*CHAR) LEN(10) | |
/* Local Variables */ | |
DCL VAR(&FROMLOC) TYPE(*CHAR) LEN(250) | |
DCL VAR(&TOLOC) TYPE(*CHAR) LEN(250) | |
DCL VAR(&CMD) TYPE(*CHAR) LEN(500) | |
/* Setup the directories */ | |
CHGVAR VAR(&FROMLOC) VALUE('/QSYS.LIB/' || &LIB *TCAT '.LIB/' || &FILE *TCAT + | |
'.FILE/' || &MEMBER *TCAT '.MBR') | |
CHGVAR VAR(&TYPE) VALUE(&TYPEIN) /* In case there is no extension */ | |
MONMSG MSGID(CPF0000) EXEC(DO) | |
CHGVAR VAR(&TYPE) VALUE(' ') | |
ENDDO | |
IF COND(&TYPE *NE ' ') THEN(DO) | |
CHGVAR VAR(&TOLOC) VALUE('/rpgSourceDump/' || &LIB *TCAT '/' || &FILE *TCAT + | |
'/' || &MEMBER *TCAT '.' || &TYPE) | |
ENDDO | |
ELSE CMD(DO) | |
CHGVAR VAR(&TOLOC) VALUE('/rpgSourceDump/' || &LIB *TCAT '/' || &FILE *TCAT + | |
'/' || &MEMBER) | |
ENDDO | |
/* Make sure the library folder exists */ | |
CHGVAR VAR(&CMD) VALUE('/rpgSourceDump/' || &LIB) | |
MKDIR DIR(&CMD) | |
MONMSG MSGID(CPFA0A0) | |
/* Make sure the source file exists */ | |
CHGVAR VAR(&CMD) VALUE('/rpgSourceDump/' || &LIB *TCAT '/' || &FILE) | |
MKDIR DIR(&CMD) | |
MONMSG MSGID(CPFA0A0) | |
/* Copy the source to a stream file */ | |
RETRYCOPY: | |
CPYTOSTMF FROMMBR(&FROMLOC) TOSTMF(&TOLOC) STMFOPT(*REPLACE) STMFCODPAG(819) | |
MONMSG MSGID(CPFA0B1 CPDA082) | |
MONMSG MSGID(CPFA097 CPDA08A) EXEC(DO) | |
RMVLNK OBJLNK(&TOLOC) | |
MONMSG MSGID(CPFA0B1 CPFA0A9) EXEC(GOTO CMDLBL(END)) | |
GOTO CMDLBL(RETRYCOPY) | |
ENDDO | |
END: | |
ENDPGM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment