One of our programmers at work is trying to create a utility to move
programs and files from a test to live environment. As part of this he
is copying source files to the live library and then he wants to check
that this has completed successfully before continuing with the next
step.
The commands he has coded are shown below:
CPYF FROMFILE(&TSTLIB/&TSTFILE) TOFILE(&SRCLIB/&SRCFILE) +
FROMMBR(&SRCMBR) TOMBR(*SRCMBR) +
MBROPT(*REPLACE)
RCVMSG MSGDTA(&MSGD) MSGDTALEN(&MSGDLEN) +
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFL)
SNDPGMMSG MSGID(&MSGID) MSGF(*LIBL/&MSGF) +
MSGDTA(&MSGD) TOMSGQ(*LIBL/BHU20Q) +
MSGTYPE(*INFO)
The Receive Message command does not appear to be retrieving message
details for the Copy File command. He has tried using
MONMSG CPF0000 CPC0000 but this also does not work.
I would appreciate any advice on this.
Thank you.
Nigel Rankin
nra...@neo.i-way.co.uk
Nigel,
Have your programmer try setting the MSGTYPE parameter to *LAST. If the
returned message id isn't CPC2955 you can loop backwards through the
message queue until you find it. Be sure to set the RMVM parameter to
*NO.
RCVMSG MSGTYPE (*LAST) RMVM(*NO) +
KEYVAR(&RtnMgKey) MSGDTA(&MSGD) MSGDTALEN(&MSGDLEN)
+
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFL)
MONMSG MSGID(CPF2415) /* End Of Requests */
MSGLOOP: If (&MSGID *NE 'CPC2955') THEN(DO)
CHGVAR &MSGKEY &RtnMsgKey
RCVMSG MSGTYPE (*PRV) MSGKEY(&MSGKEY) RMVM(*NO) +
KEYVAR(&RtnMsgKey) MSGDTA(&MSGD) MSGDTALEN(&MSGDLEN)
+
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFL)
MONMSG MSGID(CPF2415) EXEC(GOTO SENDMSG) /* End Of Requests
*/
If (&MSGID *NE 'CPC2955') THEN(GOTO MSGLOOP)
ENDDO
SENDMSG: If (&MSGID *EQ 'CPC2955') THEN(DO)
SNDPGMMSG MSGID(&MSGID) MSGF(*LIBL/&MSGF) +
MSGDTA(&MSGD) TOMSGQ(*LIBL/BHU20Q) +
MSGTYPE(*INFO)
ENDDO
If this still doesn't work, try using *EXT for the PGMQ parameter. It
may seem like a lot of work but it should get the job done.
Gary
Although I don't think most would code it quite this way, it ought to
work as you expect as long as the function completes successfully. On the
ocassions where the CPYF fails, however, this code needs some changes.
As an item of detail, the TOMBR(*SRCMBR) parameter might or might not be
okay. I don't have documentation immediately available for v3r6 or v3r7;
but in other versions of OS/400, that should probably be TOMBR(*FROMMBR).
I don't think that's what's giving you trouble though.
If those three statements are a precise representation of the sequence of
instructions, then the RCVMSG statement isn't going to be executed
whenever the CPYF fails. The CPYF needs a message monitor enabled for it.
But that doesn't explain why it wouldn't work for a case of success. Can
you add anything more? E.g., when you do a DSPMSG for msgq(BHU20Q), what
severity is specified?
Tom Liotta
Alaska Dept of Education
In article <3411089f...@news.i-way.co.uk>,
nra...@neo.i-way.co.uk wrote:
>
>
> One of our programmers at work is trying to create a utility to move
> programs and files from a test to live environment. As part of this he
> is copying source files to the live library and then he wants to check
> that this has completed successfully before continuing with the next
> step.
>
> The commands he has coded are shown below:
>
> CPYF FROMFILE(&TSTLIB/&TSTFILE) TOFILE(&SRCLIB/&SRCFILE) +
> FROMMBR(&SRCMBR) TOMBR(*SRCMBR) +
> MBROPT(*REPLACE)
>
> RCVMSG MSGDTA(&MSGD) MSGDTALEN(&MSGDLEN) +
> MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFL)
>
> SNDPGMMSG MSGID(&MSGID) MSGF(*LIBL/&MSGF) +
> MSGDTA(&MSGD) TOMSGQ(*LIBL/BHU20Q) +
> MSGTYPE(*INFO)
>
> The Receive Message command does not appear to be retrieving message
> details for the Copy File command. He has tried using
> MONMSG CPF0000 CPC0000 but this also does not work.
>
> I would appreciate any advice on this.
>
> Thank you.
>
> Nigel Rankin
> nra...@neo.i-way.co.uk
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet