/* ************************************************************************** */
/* DBG108CL: Create program file set */
/* Copyright (C) 2000 Martin Rowe <martin@dbg400.net> */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* ************************************************************************** */
PGM (&QUALPGMS &TOLIB &ALLFILES &ALLCALLED)
DCL VAR(&QUALPGMS) TYPE(*CHAR) LEN(402)
DCL VAR(&PGMLIST) TYPE(*CHAR) LEN(401)
DCL VAR(&TOLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&PROGRAM) TYPE(*CHAR) LEN(10)
DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&ALLFILES) TYPE(*CHAR) LEN(1)
DCL VAR(&ALLCALLED) TYPE(*CHAR) LEN(1)
DCL VAR(&TYPE) TYPE(*CHAR) LEN(1)
DCL VAR(&HEXNBR) TYPE(*CHAR) LEN(2)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
DCL VAR(&NBRPGMS) TYPE(*DEC) LEN(15 5)
DCL VAR(&STARTPOS) TYPE(*DEC) LEN(3 0)
DCL VAR(&TOTLEN) TYPE(*DEC) LEN(3 0)
/* ************************************************************************** */
/* START OF MAINLINE CODE */
/* ************************************************************************** */
/* Validate target library existance */
CHKOBJ OBJ(&TOLIB) OBJTYPE(*LIB)
MONMSG MSGID(CPF9800) EXEC(DO)
CHGVAR VAR(&MSGDTA) VALUE('TOLIB(' |< &TOLIB |> ') +
not authorised or not found')
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV) MSGTYPE(*INFO)
ENDDO
/* Validate program(s) existance */
/* Get the number of programs passed in */
CHGVAR VAR(&HEXNBR) VALUE(%SST(&QUALPGMS 1 2))
CHGVAR VAR(&STARTPOS) VALUE(1)
CHGVAR VAR(&NBRPGMS) VALUE(%BIN(&HEXNBR))
/* Clean up list of programs to remove any invalid data */
CHGVAR VAR(&TOTLEN) VALUE(&NBRPGMS * 20)
CHGVAR VAR(&PGMLIST) VALUE(%SST(&QUALPGMS 3 &TOTLEN))
CHGVAR VAR(%SST(&PGMLIST 401 1)) VALUE(':')
CHGVAR VAR(&STARTPOS) VALUE(1)
NextPgm:
CHGVAR VAR(&PROGRAM) VALUE(%SST(&PGMLIST &STARTPOS 10))
IF COND(&PROGRAM *EQ '*ALL') THEN(GOTO +
CMDLBL(NextStage))
CHGVAR VAR(&STARTPOS) VALUE(&STARTPOS + 10)
CHGVAR VAR(&PGMLIB) VALUE(%SST(&PGMLIST &STARTPOS 10))
CHKOBJ OBJ(&PGMLIB/&PROGRAM) OBJTYPE(*PGM)
MONMSG MSGID(CPF9800) EXEC(DO)
CHGVAR VAR(&MSGDTA) VALUE('PROGRAM(' |< &PGMLIB |< '/' |< +
&PROGRAM |> ') not authorised or not found.')
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV) MSGTYPE(*INFO)
ENDDO
MONMSG MSGID(CPF0001) /* CHKOBJ error if GENERIC* program input */
CHGVAR VAR(&STARTPOS) VALUE(&STARTPOS + 10)
IF COND(&STARTPOS *GT &TOTLEN) THEN(GOTO +
CMDLBL(NextStage))
GOTO CMDLBL(NextPgm)
NextStage:
IF COND(&MSGDTA *GT ' ') THEN(DO)
SNDPGMMSG MSGID(CPF9899) MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
GOTO CMDLBL(ENDPGM)
ENDDO
/* Call the main routine */
/* If the job isn't in batch, submit it and exit */
RTVJOBA TYPE(&TYPE)
IF (&TYPE *EQ '1') THEN(DO)
SBMJOB CMD(CALL PGM(DBG108R4) PARM(&PGMLIST +
&NBRPGMS &TOLIB &ALLFILES &ALLCALLED)) JOB(CRTPGMFSET)
GOTO CMDLBL(ENDPGM)
ENDDO
ELSE CMD(CALL PGM(DBG108R4) PARM(&PGMLIST +
&NBRPGMS &TOLIB &ALLFILES &ALLCALLED))
ENDPGM:
RETURN
ENDPGM
--
MartinRowe - 24 Jun 2005