I put in a loop, but I never see CPC1221 show up ??
------------------------------------------------------
AGAIN:
RCVMSG MSGTYPE(*ANY) WAIT(25) MSG(&RMSG) MSGID(&MID)
IF COND(&MID *EQ 'CPC1221') THEN(DO)
CHGVAR VAR(&JOBNO) VALUE(%SST(&RMSG 5 6))
GOTO CMDLBL(DONE)
ENDDO
GOTO CMDLBL(AGAIN)
DONE:
CPYSPLF FILE(file) TOFILE(libl/&USER) +
JOB(&JOBNO/&USER/&JOB)
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Don Cavaiani
Sent: Wednesday, May 14, 2008 12:29 PM
To: Midrange Systems Technical Discussion
Subject: RE: CPYSPLF - but don't know the spooled file number
Got stuck - with BLANKS being returned by the RCVMSG command.
1) Run MY CLP
2) CALLS the CLP from the Vendor
3) Display a screen for input selections parms
4) Enter parms
5) Press to submit to batch
6) An RPGLE program runs and generates the print spool file
7) RCVMSG MSGTYPE(*COMP) MSGDTA(&RMSG) MSGID(&MID)
8) CHGVAR VAR(&JOBNO) VALUE(%SST(&RMSG 21 6))
9) CPYSPLF is run
ERROR on CPYSPLF because job no field is not populated
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Don Cavaiani
Sent: Wednesday, May 14, 2008 10:23 AM
To: Midrange Systems Technical Discussion
Subject: RE: CPYSPLF - but don't know the spooled file number
You're right! Found the following in the archives! Thanks to all!
Todd wrote:
In a CL program, what's the best way to get the job number of a job
that was just submitted.
This is what we are currently doing...
SBMJOB CMD(CALL PGM(program))
RCVMSG MSGTYPE(*LAST) MSG(&RMSG) MSGID(&MID)
IF COND(&MID *EQ 'CPC1221') THEN(DO)
CHGVAR VAR(&JOBNO) VALUE(%SST(&RMSG 5 6))
ENDDO
This works fine, but sometimes the message text will be in Spanish and
the job number is in a different position. Is there a better way to do
it so that it doesn't matter what language is used????
You're very close!
Instead of using the MSG() parameter, use the MSGDTA() parameter.
MSGDTA()
contains the substitution data, not the "finished" message. Do a
DSPMSGC CPC1221, option 1 and you'll see
Job &3/&2/&1 submitted to job queue &4 in library &5.
Those '&1', etc. notations are parameter markers. They say that the
program sending the message can substitute actual data in those places.
Now look at option 2 and you'll see
Field Data Type Length
&1 *CHAR 10
&2 *CHAR 10
&3 *CHAR 6
&4 *CHAR 10
&5 *CHAR 10
You can think of the 'field data' as a data structure. The first 10
characters are &1 (job name), the next 10 are the user, the next 6 the
job number. ADDMSGD has some explanation of how this works.
http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/info/cl/addmsg
d.ht
m as does the CL Programming book
http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/books/c4157214
.pdf
(chapters 7 and 8) This question has been added to the FAQ.
--buck
------------------------------------------------------------------------
--------
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Don Cavaiani
Sent: Wednesday, May 14, 2008 9:53 AM
To: Midrange Systems Technical Discussion
Subject: RE: CPYSPLF - but don't know the spooled file number
That sounds good - I will try that!
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Crispin Bates
Sent: Wednesday, May 14, 2008 9:45 AM
To: Midrange Systems Technical Discussion
Subject: Re: CPYSPLF - but don't know the spooled file number
CPC1221 is sent as a completion message when the job is submitted. You
can RCVMSG MSGTYPE(*COMP), compare the message Id, and if CPC1221 you
can then get the job number from the message data...
----- Original Message -----
From: "Don Cavaiani" <dcavaiani@xxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Wednesday, May 14, 2008 10:28 AM
Subject: RE: CPYSPLF - but don't know the spooled file number
I'm SORRY - I mean the JOB NUMBER - not the spooled file number.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Nick W Mart
Sent: Wednesday, May 14, 2008 9:24 AM
To: Midrange Systems Technical Discussion
Subject: Re: CPYSPLF - but don't know the spooled file number
Don,
There are other entries for the spooled file number parameter. These
include *ANY, *ONLY, and *LAST.
HTH,
Nick
----- Original Message -----
From: "Don Cavaiani" <dcavaiani@xxxxxxxxxxxxx>
To: <midrange-l@xxxxxxxxxxxx>
Sent: Wednesday, May 14, 2008 9:14 AM
Subject: CPYSPLF - but don't know the spooled file number
Greetings,
I run a menu step which is a CLP I created and which CALLS an
Outside_Print_Package_Program (CLP & RPG) for which I have no SOURCE
CODE.
The program which loads up requests options, and may then be run
interactively or in batch.
I would prefer this to run in batch all the time, but then I need to
CPYSPLF the printer spooled output file and do some further
processing. I
want to automatically retrieve and fill in the required CPYSPLF
command
options, but I don't think I will know or have access to the "spooled
file
number" (unless I manually look it up) when the job is submitted to
batch.
Is that correct? Am I missing something simple here?
TIA
Don
Don F. Cavaiani
IT Manager
Amerequip Corp.
920-894-7063
"It's amazing what you can accomplish if you don't care who gets the
credit." Harry S. Truman
--
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.
No virus found in this incoming message Checked by PC Tools AntiVirus
(4.0.0.26 - 10.072.008).
http://www.pctools.com/free-antivirus/
No virus found in this outgoing message Checked by PC Tools AntiVirus
(4.0.0.26 - 10.072.008).
http://www.pctools.com/free-antivirus/
--
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.
--
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.
--
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.
--
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.
--
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.
--
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.