|
Chaps,
That's it.
Finally, here's a good test:
The program should be called, and the screen should appear.
I'll try and set up a savf to download on my website.
Cheers
Larry Ducie
Source:
1) STRJOBCMD - CLLE 2) SNDJOBCMD - CLLE 3) ENDJOBCMD - CLLE 4) EXITTRC - CLLE 5) STRJOBCMD - CMD 6) SNDJOBCMD - CMD 7) ENDJOBCMD - CMD
1) STRJOBCMD - CLLE /* **************************************************************** */ PGM PARM(&JOB &SRVJOB)
DCL VAR(&JOB) TYPE(*CHAR) LEN(26) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) DCL VAR(&SRVJOB) TYPE(*CHAR) LEN(1) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10)
/* Extract job details... */ CHGVAR VAR(&NAME) VALUE(%SST(&JOB 1 10)) CHGVAR VAR(&USER) VALUE(%SST(&JOB 11 10)) CHGVAR VAR(&NUMBER) VALUE(%SST(&JOB 21 6))
/* Service job..? */ IF COND(&SRVJOB *EQ 'Y') THEN(DO) STRSRVJOB JOB(&NUMBER/&USER/&NAME)
/* Job does not exist... */ MONMSG MSGID(CPF3520) EXEC(DO) SNDPGMMSG MSG('The job you are trying to send a + command to does not exist') TOPGMQ(*PRV) GOTO CMDLBL(END) ENDDO
/* Job already being serviced... */ MONMSG MSGID(CPF3501) EXEC(DO) SNDPGMMSG MSG('Job is already being serviced, traced + or debugged') TOPGMQ(*PRV) GOTO CMDLBL(END) ENDDO
/* Already servicing another job... */ MONMSG MSGID(CPF3938) EXEC(DO) SNDPGMMSG MSG('You are already servicing another job') + TOPGMQ(*PRV) GOTO CMDLBL(END) ENDDO
/* General errors... */ MONMSG MSGID(CPF3500) EXEC(DO) SNDPGMMSG MSG('An error occurred when trying to + service the job. See joblog for + details.') TOPGMQ(*PRV) GOTO CMDLBL(END) ENDDO ENDDO
/* Create message queue... */ CHGVAR VAR(&MSGQ) VALUE('SRVJ' *CAT &NUMBER) CRTMSGQ MSGQ(JOBCMDLIB/&MSGQ) MONMSG CPF9999
/* Set trace... */ TRCJOB EXITPGM(JOBCMDLIB/EXITTRC) MONMSG CPF9999 EXEC(DO) SNDPGMMSG MSG('An error occurred when trying to + trace the job. See joblog for + details.') TOPGMQ(*PRV) IF COND(&SRVJOB *EQ 'Y') THEN(DO) ENDSRVJOB MONMSG MSGID(CPF9999) ENDDO DLTMSGQ MSGQ(JOBCMDLIB/&MSGQ) MONMSG CPF9999 GOTO CMDLBL(END) ENDDO
END: ENDPGM
2) SNDJOBCMD - CLLE /* **************************************************************** */ PGM PARM(&JOB &CMD)
DCL VAR(&JOB) TYPE(*CHAR) LEN(26) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) DCL VAR(&CMD) TYPE(*CHAR) LEN(512) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10)
/* Extract job details... */ CHGVAR VAR(&NAME) VALUE(%SST(&JOB 1 10)) CHGVAR VAR(&USER) VALUE(%SST(&JOB 11 10)) CHGVAR VAR(&NUMBER) VALUE(%SST(&JOB 21 6))
/* Send command to message queue... */ CHGVAR VAR(&MSGQ) VALUE('SRVJ' *CAT &NUMBER) SNDPGMMSG MSG(&CMD) TOMSGQ(JOBCMDLIB/&MSGQ) MONMSG MSGID(CPF2469) EXEC(DO) SNDPGMMSG MSG('An error occured while sending the + command. Please re-enter the details.') GOTO CMDLBL(END) ENDDO
END: ENDPGM
3) ENDJOBCMD - CLLE /* **************************************************************** */ PGM PARM(&JOB &SRVJOB)
DCL VAR(&JOB) TYPE(*CHAR) LEN(26) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) DCL VAR(&SRVJOB) TYPE(*CHAR) LEN(1) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10)
/* Extract job details... */ CHGVAR VAR(&NAME) VALUE(%SST(&JOB 1 10)) CHGVAR VAR(&USER) VALUE(%SST(&JOB 11 10)) CHGVAR VAR(&NUMBER) VALUE(%SST(&JOB 21 6))
/* End trace... */ TRCJOB SET(*END) MONMSG CPF9999
/* End service job... */ IF COND(&SRVJOB *EQ 'Y') THEN(DO) ENDSRVJOB MONMSG CPF9999 ENDDO
/* Delete message queue... */ CHGVAR VAR(&MSGQ) VALUE('SRVJ' *CAT &NUMBER) DLTMSGQ MSGQ(JOBCMDLIB/&MSGQ) MONMSG CPF9999
ENDPGM
4) EXITTRC - CLLE PGM PARM(&TRCDTA)
DCL VAR(&TRCDTA) TYPE(*CHAR) LEN(1024) DCL VAR(&CMD) TYPE(*CHAR) LEN(1024) DCL VAR(&LEN) TYPE(*DEC) LEN(15 5) VALUE(512) DCL VAR(&MSGTXT) TYPE(*CHAR) LEN(512) DCL VAR(&NAME) TYPE(*CHAR) LEN(10) DCL VAR(&USER) TYPE(*CHAR) LEN(10) DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&SENDER) TYPE(*CHAR) LEN(80) DCL VAR(&LOG) TYPE(*CHAR) LEN(512)
/* Set trace record as processed... */ CHGVAR VAR(&TRCDTA) VALUE(' ')
/* Retrieve job attributes... */ RTVJOBA JOB(&NAME) USER(&USER) NBR(&NUMBER)
/* Receive message from queue... */ CHGVAR VAR(&MSGQ) VALUE('SRVJ' *CAT &NUMBER) RCVMSG MSGQ(JOBCMDLIB/&MSGQ) MSG(&MSGTXT) + SENDER(&SENDER) MONMSG MSGID(CPF9999) EXEC(GOTO CMDLBL(END))
/* Set command... */ CHGVAR %SST(&CMD 1 1024) %SST(&MSGTXT 1 &LEN)
/* Send log messages, if message received... */ IF COND(&MSGTXT *NE ' ') THEN(DO) CHGVAR VAR(&LOG) VALUE(&SENDER *CAT &NAME *CAT + &USER *CAT &NUMBER) SNDPGMMSG MSG(&LOG) TOMSGQ(JOBCMDLIB/CMDLOG) CHGVAR VAR(&LOG) VALUE(&CMD) SNDPGMMSG MSG(&LOG) TOMSGQ(JOBCMDLIB/CMDLOG) MONMSG CPF0000
/* Call QCMDEXC to process command... */ CALL PGM(QCMDEXC) PARM(&CMD &LEN) MONMSG CPF0000 ENDDO
END: ENDPGM
5) STRJOBCMD - CMD CMD PROMPT('Start Job Command Processing')
PARM KWD(JOB) TYPE(Q1) MIN(1) PROMPT('Job name . + . . . . . . . . . .')
PARM KWD(SRVJOB) TYPE(*CHAR) LEN(1) RSTD(*YES) + DFT(Y) VALUES(Y N) CHOICE('(Y/N)') + PROMPT('Service Job . . . . . . . . .') /*********************************************************************/ Q1: QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('Name') QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('User') + PROMPT('User . . . . . . . . . . . . .') QUAL TYPE(*CHAR) LEN(6) RANGE(000000 999999) + MIN(1) CHOICE('000000-999999') + PROMPT('Number . . . . . . . . . . . .') ****************** End of data ****************************************
6) SNDJOBCMD - CMD CMD PROMPT('Send Job Command')
PARM KWD(JOB) TYPE(Q1) MIN(1) PROMPT('Job name . + . . . . . . . . . .')
PARM KWD(CMD) TYPE(*CMDSTR) LEN(512) MIN(1) + CHOICE('Command') + PROMPT('Command . . . . . . . . . . .')
/*********************************************************************/ Q1: QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('Name') QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('Name') + PROMPT('User . . . . . . . . . . . . .') QUAL TYPE(*CHAR) LEN(6) RANGE(000000 999999) + MIN(1) CHOICE('000000-999999') + PROMPT('Number . . . . . . . . . . . .')
7) ENDJOBCMD - CMD *************** Beginning of data ************************************* CMD PROMPT('End Job Command Processing')
PARM KWD(JOB) TYPE(Q1) MIN(1) PROMPT('Job name . + . . . . . . . . . .')
PARM KWD(SRVJOB) TYPE(*CHAR) LEN(1) RSTD(*YES) + DFT(Y) VALUES(Y N) CHOICE('(Y/N)') + PROMPT('End service job . . . . . . .')
/*********************************************************************/ Q1: QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('Name') QUAL TYPE(*NAME) LEN(10) MIN(1) CHOICE('User') + PROMPT('User . . . . . . . . . . . . .') QUAL TYPE(*CHAR) LEN(6) RANGE(000000 999999) + MIN(1) CHOICE('000000-999999') + PROMPT('Number . . . . . . . . . . . .')
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.