God_of_Thunder
God_of_Thunder

Reputation: 763

How to display message at the bottom of a display file in CL program?

Suppose a display file has been declared in a CL program. It accepts some user input and conducts some validations to it. If it fails the validation a message would be displayed on the bottom of the display file. Is it possible to achieve this in CL? I have tried SNDPGMMSG with MSGTYPE(*DIAG), but the message is displayed only after the program has been terminated, and not on the display file during the execution.

The message to be sent is retrieved from message file so using field to display message is not applicable.

Upvotes: 1

Views: 3974

Answers (2)

Buck Calabro
Buck Calabro

Reputation: 7648

Define a 75 character field in your display file DDS. Call it MESSAGE. In your CL do something like:

if (&option *ge '35') do
  CHGVAR &MESSAGE 'Invalid option chosen'
  goto getOption
enddo

Upvotes: 1

lamLam
lamLam

Reputation: 475

Normally we use message subfile to achive what you required above. It can be done in display file for both CL and RPG

For CL example, you could read here http://www.mcpressonline.com/cl/the-cl-corner-letting-the-user-know-what-s-right-and-wrong.html. You could search for "cl program message subfile" for other examples

Upvotes: 4

Related Questions