× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Pete,

<snip>
I have an program that displays records in a subfile and it works great,
until there are no records to display. In that case it crashes with a
predictable RNQ1255. I set off the subfile display indicator before I
EXFMT when I have no records to display so I am wondering if there is
other logic I need to add so I can at least display the empty subfile
screen.
</snip>

You should not display the subfile. The display of the subfile is conditioned on the value of the indicator associated with the SFLDSP DDS keyword.

After you build your subfile, but before you EXFMT the control format you should check the number of rows you have written to the subfile by checking your RRN field (defined using SFILE keyword on F-specs). If your RRN field is > 0 then set SFLDSP on, otherwise set it *off
and write a format that displays some text alerting the user there are no rows.

IBM likes to write a line of text wrapped in braces on what would be the second subfile line and slightly indented. You would just create a new format in your DDS, include a field in that screen position, and specify OVERLAY at the format level.

Something like:

DDS:
A R NORECS OVERLAY
A 6 6MSGCON(060 MY10573 *LIBL/MYMSGF)

RPG:
if rrn01 > 0;
s_sfldsp = *on;
else;
s_sfldsp = *off;
write NORECS;
endif;

...

exfmt CTL;

This is why you should NEVER condition SFLDSPCTL and SLFDSP on the same indicator. If you do then displaying the control (which usually contains your header fields) will try to display the empty subfile, and Bang!

HTH

Cheers

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.