How can we send error message at message line from RPGLE program.

695 pts.
Tags:
AS/400 errors
RPGLE
RPGLE Program
Hi All, I want to send one error message at AS/400 message line from my RPGLE program. for example i want to send one error message to the user saying that "ABC File is empty" if he excutes my program.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Does this RPGLE program have a display file?
Phil

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mohan K
    Hi Phil, No, RPGLE program is not using any display file. here i will explain what i am doing in program. I have developed one normal RPGLE program without any display file or printer file. the main purpose of the program is to check is there any records are available in input file or not if no records are available in file then i have to send error message to the user with " There are no records in ABC input file to process" at as400 message line which is below to AS400 command line. if no records available in file i am just calling one CL from my RPGLE program with above message to be diplay at message line to user. please find below CL code which is used to send error message to user at message line. ** PGM PARM(&MSG) DCL VAR(&MSG) TYPE(*CHAR) LEN(100) SNDPGMMSG MSG(&MSG) ENDPGM ** is the above code is correct to send error message to the user at message line which is below to as400 command line ? please tell me thanks in advance
    695 pointsBadges:
    report
  • Koohiisan
    I like to use sndpgmmsg in my RPG programs as well. So, here's what you have to declare: dsndpgmmsg pr extpgm('QMHSNDPM') d messageid 7a const d qualmsgf 20a const d msgdata 256a const d msgdtalen 10i 0 const d msgtype 10a const d callstkent 10a const d callstkcnt 10i 0 const d messagekey 4a d errorcode 32766a options(*varsize) ddsec ds d dsecbytesp 1 4i 0 inz(256) d dsecbytesa 5 8i 0 inz(0) d dsecmsgid 9 15 d dsecreserv 16 16 d dsecmsgdta 17 256 dprTheKey s 4a dvarmsg s 256a Then, I have a subroutine that I call to send either status messages or completion messages (see which kind you want to use by trying them): //----------------------------------------------------------------------- begsr LeavePgmMsg; // use the QMHSNDPM API to send a completion message to the caller! callp SndPgmMsg('CPF9897': 'QCPFMSG *LIBL': varMsg: 256: '*COMP': '*CTLBDY': 1: prTheKey: dsEC); endsr; //----------------------------------------------------------------------- begsr LeaveStatusMsg; // use the QMHSNDPM API to send a status message to the caller! callp SndPgmMsg('CPF9897': 'QCPFMSG *LIBL': varMsg: 256: '*STATUS': '*EXT': 1: prTheKey: dsEC); endsr; //----------------------------------------------------------------------- Hope this helps!
    5,020 pointsBadges:
    report
  • YuVa47
    Hi, It would work, but is probably better to have the following instead: SNDPGMMSG MSGDTA(&MSG) MSGTYPE*ESCAPE) BTW, why don't check already in the CL if the file have any records? RTVMBRD FILE(*LIBL/&FILE ) NBRCURRCD(&RCD) IF COND(&RCD = 0) THEN(DO) SNDPGMMSG MSGDTA(&MSG) MSGTYPE*ESCAPE) ENDDO Good luck
    1,300 pointsBadges:
    report
  • Bigmac46
    or In your clle determine the user or work station to get the message - then, when you find the no records status - You might be able to just call the clle to send the message . or CALL 'QCMDEXC' to call your clle i think it will work
    1,000 pointsBadges:
    report
  • Mohan K
    thanks to all of you for your valuable suggestions.
    695 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following