How to display a variable value in CLP

425 pts.
Tags:
CLP
CLPROGRAM
ILE CLP
Similar to DSPLY in RPG, is there any command to display varibale value using CL program. I tried with DSPPGMVAR command in CLP, but its valid only in debug mode.

Software/Hardware used:
Iseries
ASKED: February 19, 2010  11:03 AM
UPDATED: February 19, 2010  10:59 PM

Answer Wiki

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

For a quick display purposes I generally use the Send Program Message (SNDPGMMSG) command with the MSG parameter set to the variable to be displayed. One consideration is that you need to first convert any non-character variables to character.

=============================================

SNDUSRMSG <i>might</i> be a little less intimidating than SNDPGMMSG. Or SNDMSG TOUSR(*REQUESTER) can be even easier. The same ‘character conversion’ advice applies, though. At times, the most useful to me is DMPCLPGM inserted at one or more points in the program. A dump of all variables is spooled in the job and can be viewed like any spooled output.

If the purpose is for user interaction, then perhaps an actual display file is called for. Declare the file with DCLF and use SNDRCVF like you would use EXFMT in RPG.

Tom

Discuss This Question: 1  Reply

 
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
  • Sloopy
    Another way we used to do it is putting the variable into a data area and using DSPDTAARA. Then you don't have the same sort of conversion problems you would have with the SNDPGMMSG method. I assume that displaying the contents of the variable is only for testing purposes - it would look inelegant coming up in the middle of a live application.
    2,195 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