× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



See Below:

DCL &ERRORSW *LGL
DCL &MSGID *CHAR LEN(7)
DCL &MSG *CHAR LEN(512)
DCL &MSGDTA *CHAR LEN(512)
DCL &MSGLEN *DEC LEN(5 0)
DCL &MSGF *CHAR LEN(10)
DCL &MSGFLIB *CHAR LEN(10)
DCL &KEYVAR *CHAR LEN(4)
DCL &KEYVAR2 *CHAR LEN(4)
DCL &RTNTYPE *CHAR LEN(2)
DCL &MSGKEY *CHAR LEN(4)
DCL &DEVICE *CHAR LEN(10)
DCL &USER *CHAR LEN(10)
DCL &NBR *CHAR LEN(6)
DCL &TYPE *CHAR LEN(1)
DCL &SENDER *CHAR LEN(80)
DCL &PROGRAM *CHAR LEN(10)

RTVJOBA JOB(&DEVICE) USER(&USER) NBR(&NBR) TYPE(&TYPE)

IF (&TYPE = '1') THEN(DO)

SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) TOPGMQ(*SAME) +

KEYVAR(&MSGKEY)

RCVMSG MSGTYPE(*INFO) MSGKEY(&MSGKEY) WAIT(*MAX) +

SENDER(&SENDER)

CHGVAR VAR(&PROGRAM) VALUE(%SST(&SENDER 27 10))

SBMJOB CMD(CALL PGM(&PROGRAM)) +
JOB(&PROGRAM) LOG(4 00 *SECLVL)

RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID) +

MSGF(&MSGF) MSGFLIB(&MSGFLIB)

SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +

MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*COMP)

RETURN

ENDDO




The Send program message figures out what the name of this program running
is, then submits the job. The RCVMSG and SNDPGMMSG afterwards retrieve the
submission message and put it on to this programs top message queue. You
can of course convert this to RPG or COBOL with no real problem.

--
Jim Oberholtzer
Chief Technical Architect
Agile Technology Architects


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John
Yeung
Sent: Saturday, October 04, 2014 11:10 PM
To: Midrange Systems Technical Discussion
Subject: How to programmatically submit a job and know its job number

I am wondering how (if there is a way at all) to programmatically submit a
job in such a way that the submitting program knows the submitted job
number. The purpose of knowing the job number would be to save it for
later, in case the submitted job (scheduled to run potentially far in the
future) needs to be ended/canceled, again programmatically.

The reason I'm hoping to know the number is that it would be convenient to
submit jobs with the same job name, but distinguish them by number. If
there isn't a (sufficiently convenient) way to do this, then I can come up
with a scheme to submit jobs with unique job names.
But before going that route, I thought I'd check with the experts.
This sounds like something other folks would have had occasion to do.

John Y.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.