CL SNDUSRMSG to PF

Tags:
AS/400
CL Program
CL/400
Physical File
Hi All,
I am new to CL/400, please help me to understand it.
Below is the simple CL program.
PGM DCL VAR(&A) TYPE(*DEC) LEN(4 0) VALUE(10) 
DCL VAR(&B) TYPE(*DEC) LEN(4 0) VALUE(20) 
DCL VAR(&C) TYPE(*DEC) LEN(4 0) 
DCL VAR(&D) TYPE(*CHAR) LEN(6) 
CHGVAR VAR(&C) VALUE(&A + &B) 
CHGVAR VAR(&D) VALUE(&C) 
SNDPGMMSG MSG('RESULT IS:' *CAT &D)
ENDPGM
I have have few questions:
  1. How to clear previous messages?
  2. Can I send &D value to a Physical File? If yes, how?
Thank you.
Siva.


Software/Hardware used:
as400, iseries, IBM i
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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.
  • pdraebel
    Clearing the messages from the default program queue can be done by logging off and signing back on again. For 2 : CL natively does not support file additions. Maybe send them to the program queue of another program that receives the message and than writes it to a file.
    7,545 pointsBadges:
    report
  • pdraebel
    BTW you can do a receive of the messages. The receive will give the option to remove the received message.
    7,545 pointsBadges:
    report
  • GregManzo
    Sounds like homework.
    Try looking up the RCVMSG & RMVMSG commands for some ideas on removing the previous messages.
    As for writing to a file, consider using SQL to insert a record, or passing it to a RPG program to write it.
    2,950 pointsBadges:
    report
  • sivaknagula
    Thank you very much.
    55 pointsBadges:
    report
  • ToddN2000
    Why is there a need to send it to a PF? Usually messages are for informational use not for archiving. Your question mentions user message but the example shows program message.
    131,440 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.

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

Following

Share this item with your network: