Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
If the DSPSFL keyword is optioned ON, and the number of Subfile records = 0 it causes an error. I tend to use the SFLRCDCSR keyword and if that's 0 or greater than the number of records in the file, you also get an error.
As Bob says the most common reason is an empty subfile. Many, many programmers seem to use a single indicator for both SFLDSP and SFLDSPCTL - and never consider the situation where the subfile might be empty.
Bob, did you mean SFLRCDNBR, possibly SFLRCDNBR(*CURSOR)?
Like Neil says, I tend to use 11 SFLDSPCTL and 11 12 SFLDSP, which allows me to display the control record even if the subfile is empty. This also sets me up for N11 SFLCLR, for initializing the empty subfile. On 11 N12, I write an alternate format which gives the '(No xxx found)' where the subfile would have been, like a UIM dialog (though, of course, it's all INDDS in the code).
i personally use one indicator for both. my approach is to NEVER have an empty subfile. if the system returns an "empty" subfile, i initialize subfile record 1 with something like "No records found for this account".
-sarge
I use DDS keyword ERASE(MYSFLREC) if the subfile is empty, using same indicator as SFLDSP but "Not".
A 90 SFLDSP
A N90 ERASE(MYSFLREC)
Chris
Dale, yes.