Or you could create 1 subfile record with the message “No Records exist” in the first text field.
set indicator in subfile display, subfile display control..
eval *in35=*on -> ON subfile display control indicator
exfmt subctl -> subfile control record format name
and switch off subfile display and subfile display control indicator
after you getting empty subfile….
thanx every1.deepu and sathish that exactly is the answer i was looking for.
what exactly is the scenario if we use MONMSG to capture the error. is it possible??
You cannot have the MONMSG Command in RPGLE.
Why would you like to use MONMSG, Main use of having MONMSG is for error handling.
You can follow the above suggested procedure for avoiding the Program Crash.
If Records > 0 ;
Switch Display & Display Control Indicators
Switch Display Control Indicator Only
Write Control Format
use MONMSG to capture the error. is it possible??
Possible, yes (monitor message is a CL process but there are RPG ways to capture errors/exceptions) that might work in this case, however, these seem totally inappropriate. The program has to compute the subfile RRN to write subfile records so it a staight forward process to use Pradeep recommendion. Pradeep’s recommendation it is the standard practice for handling this case.
Firstly.. during CLRSFL : eval dspctl = *off
eval clear = *on
eval dspctl =*on
eval clear = *off
after reading PF:
Only switch on SFLDSP if RRN > 0
in else do as
Philpl1jb suggested .