Midrange News for the IBM i Community


Posted by: neilrh
A/P
Jackson, MI
Subfile strangeness
has no ratings.
Published: 20 Apr 2012
Revised: 23 Jan 2013 - 1553 days ago
Last viewed on: 25 Apr 2017 (3975 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.

Subfile strangeness Published by: neilrh on 20 Apr 2012 view comments(4)

So, from the top: DSPF - RSTDSP(*YES), SHARE(*YES)

Call RPG1 opens DSPF includes all display formats, it loads up subfile1 (I watch it read the records from file and write them), screen is displayed, look at displayed subfile data and it's all good.  Press function key that calls RPG2, this is the program that shares the DSPF, it does NOT include subfile1.  Return to RPG1, subfile1 is read in and each line updated to the database file - we're still all good at this point.  I press <ENTER> which proceeds to detail line #2.  Subfile1 is cleared and once again loaded from file with records pertinent to line#2 (and yes I watch it through debug).  The subfile is displayed on screen and I confirm that the data is all correct.  Press function key to call RPG2, return back to RPG1, and when it reads the data from the subfile it's the records that were in Subfile1 when RPG2 was called the first time.

Is RSTDSP causing me problems?  The fact that RPG2 does not include subfile1?  I've never tried to code stuff like this before - basically the original programmer is using subfile2 as an array parameter between RPG1 & RPG2 - but something is screwing up my data, and it's causing the kind of problems that cost lots of money! 

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

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Subfile strangeness
Posted: 5 years 5 days 4 hours 50 minutes ago

In PGM2 is the display file declared with the INCLUDE or IGNORE keywords?

If you have INCLUDE(...) do you have only the record formats you are using the PGM2? If not then all formats are in PGM2 whether you use them or not.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Subfile strangeness
Posted: 5 years 5 days 4 hours 15 minutes ago

PGM2 uses the INCLUDE keyword on the display file, with only the record formats used in that program.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Subfile strangeness
Posted: 5 years 5 days 2 hours 20 minutes ago

Test PGM2 by adding/including the subfile in the INCLUDE keyword. Then issue a dummy read/write to it but never execute those statements. Then see if you have different results.

If so, it may be that there is an issue with SHARED ODP and the INCLUDE/IGNORE keywords in RPG.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Subfile strangeness
Posted: 5 years 5 days 2 hours 6 minutes ago

That does not seem to be the issue.

I've been reading through the IBM manuals, and they state that when RSTDSP is set for a display file, when you display another screen (PGM2 calls both PGM3 and PGM4 which both have unique DSPFs associated), the screen is "saved" and when you exit from the new screen the saved screen is restored.  My guess is that this "save" only happens the first time the screen is suspended.  After that it restores the first time save each time.