Etienne, 

If you want to stick to using CL's SNDPGMMSG instead of the QMHSNDPM
api, then you could create your program using two modules.  One would be
CL and the other would be your C module.
For example, 
CRTCLMOD MODULE(QGPL/MYCLMOD) SRCFILE(QGPL/QCLSRC)
CRTCMOD MODULE(QGPL/MYCMOD) SRCFILE(QGPL/QCSRC)
CRTPGM PGM(QGPL/MYPGM) MODULE(QGPL/MYCMOD QGPL/MYCLMOD)

In your MYCMOD source you can call the CL module by doing following:
extern MYCLMOD(void);

void main(void)
{
  ....
  ....
  MYCLMOD();
  ....
  ....
}

And you invoke your program as usual, CALL MYPGM.

Hope this helps.

Elvis

-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Etienne Richards
Sent: Tuesday, June 10, 2003 12:01 AM
To: C programming iSeries / AS400
Subject: RE: [C400-L] SNDPGMMSG ILE C

Terry,

Thanks for the help up to this point. I have to ask one more thing.

When I use the CL example you sent me to send the completion message it
does
not work if the CL is called from a ILE C program (The CL works fine if
called from another CL).

I have noticed that the message is shown on the c terminal screen (I
happened to print a debug message to the screen). The program does not
typically write to stdout and I end it with exit(0) to prevent the c
terminal from being shown.

Could the exit(0) be part of the problem or do need to implement the CL
eq.
in ILE C (I would need help if the answer is yes) ?


Thanks,
Etienne

-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx]On
Behalf Of Terrence Enger
Sent: Saturday, May 31, 2003 12:34 PM
To: C programming iSeries / AS400
Subject: RE: [C400-L] SNDPGMMSG ILE C


At 11:43 2003-05-31 -0400, Etienne Richards <etienner@xxxxxxxxxxx>
wrote:
>Terry,
>
>This might be a silly question but...

Not at all.  I just didn't want to make assumptions about what you
already
know.

>
>How do I send a completion message up the program stack?
>

Here are examples in CL.

AA1722 is the basic way of doing it.  Note in particular TOPGMQ(*PRV).

AA1723 simply forwards a completion message from a called program.  This
is
what you might do in a program which is a trivial wrapper around another
program which does all the real work.

===== start AA1722 =====
pgm

             SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('AA1722 +
                          completed successfully') TOPGMQ(*PRV) +
                          MSGTYPE(*COMP)

endpgm
===== start AA1723 =====
pgm

dcl          &msgid     *char     7
dcl          &msgdta    *char  2000
dcl          &msgf      *char    10
dcl          &msgflib   *char    10

             CALL       PGM(AA1722)

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

             SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                          MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*COMP)

endpgm
===== end source files =====

Let me know if you need help translating these techniques into C.

HTH.

Terry.


_______________________________________________
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.


_______________________________________________
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.





This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].