Midrange News for the IBM i Community


Posted by: deepthi
"Session or Device error occurred" while using Subfiles in RPGLE
has no ratings.
Published: 02 Jun 2012
Revised: 23 Jan 2013 - 1522 days ago
Last viewed on: 25 Mar 2017 (9466 views) 

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.

"Session or Device error occurred" while using Subfiles in RPGLE Published by: deepthi on 02 Jun 2012 view comments(6)

I faced this issue once while using the subfiles. In that case it was because there was no record eligible in my Physical file that can be displayed on the screen and i guess i didn't initialize some of the subfile variables. Can you please explain me various cases (through your experience) where we see this error and what has to be done to avoid it.

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 23 days 3 hours 13 minutes ago

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.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 21 days 9 hours 25 minutes ago

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.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 21 days 9 hours 1 minutes ago

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).

Posted by: sarge
Premium member *
United States
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 21 days 7 hours 35 minutes ago

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

Posted by: Ringer
Premium member *
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 21 days 1 hours 49 minutes ago

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

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: "Session or Device error occurred" while using Subfiles in RPGLE
Posted: 4 years 9 months 19 days 59 minutes ago

Dale, yes.