|
At 10:59 2003-05-30 -0500, "Elvis Budimlic"
<ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>Try this in your C program:
>system("QSYS/SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSGF) MSGDTA('This is my
>text ......') TOPGMQ(*EXT) MSGTYPE(*STATUS)");
SNDPGMMSG is allowed only within a compiled CL program. Here, you get
CPD0031 "Command SNDPGMMSG not allowed in this setting."
>
>or in CL:
>QSYS/SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSGF) MSGDTA('This is my text
>.....') TOPGMQ(*EXT) MSGTYPE(*STATUS)
Better. Just change it to MSGF(QCPFMSG), and it works.
It is also possible to do this within your C program, as per this example
===== start source code =====
#include <qusec.h>
#include <qmhsndpm.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
int main (int argc, char * * argv)
{
Qus_EC_t err_code;
char msg_key [4];
char * msg_dta = "This is my text .......";
char * cmd_delay = "QSYS/DLYJOB 5";
int rc;
int ch;
/* Send status message */
err_code.Bytes_Provided = 16;
QMHSNDPM (
"CPF9898", /* message id */
"QCPFMSG *LIBL ", /* Qualified message file name */
msg_dta, /* Message data */
strlen(msg_dta), /* Length of message data */
"*STATUS ", /* Message type */
"*EXT ", /* Call stack entry */
0, /* Call stack counter */
msg_key, /* Message key */
&err_code /* Error code */
);
if (err_code.Bytes_Available != 0) {
printf ("QMHSNDPM ret'd error %7s\n", err_code.Exception_Id);
printf ("bytes available = %i\n", err_code.Bytes_Available);
return 1;
}
/* Give time to see the message. */
rc = system(cmd_delay);
assert (("system(cmd_delay)", rc==0));
return 0;
} /* main */
===== end source code =====
HTH. Please post again if you still have problems.
Terry.
Available for contract progrmming.
>
>Elvis
>
>=== original email ===
>
>All,
>
>I want to send a program message from an ILE C program that must be
>displayed at the bottom of the users screen.
>
>SNDPGMMSG can not be called from ILE C so I call a CL that sends the
>program
>message. This message only shows in the job log, how can I make it show
>on
>the users screen?
>
>Etienne
>
>
>_______________________________________________
>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.
>
>
>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.