[small _extended="true" class="upper">POSTED: [/small]
[!-- end summary --]
[I _extended="true">SFLNXTCHG sets all records in the subfile to be marked as changed…
SFLNXTCHG only sets the tag for the subfile records that are written when SFLNXTCHG is on. It only affects “all” subfile records if you have it on for every subfile record you write.
READC will read any subfile record that was updated by the user (regardless of whether or not READC read the same subfile record in a previous I/O cycle through the subfile.) READC will also read any subfile record that wasn’t changed by the user if that record was written while SFLNXTCHG was enabled.
The difference between the two is that READC is a RPG program I/O instruction and SFLNXTCHG is an attribute of a row written to a subfile regardless of whether it was written by RPG or a different language. READC is a RPG instruction; SFLNXTCHG is a DDS keyword. They’re not words from the same language.
Tom
Does this hold true if you seton the SFLNXTCHG indicator and UPDATE the subfile record?
My subfile allows prompting on a field to pull up another subfile in a window. A record is selected, control passes back to the program, I update the subfile with the selected data and I want to process changed records in the subfile to update the db file. READC indicator comes on stating there are no changed records to process.
* Prompt carrier field C EXSR SRCarrier
* Update selection to subfile C rrn chain sflrcd C Movel Wcarc @carc
* zero the cursor information for dspatr(pc) *in50 C z-add 0 ccol C z-add 0 clin C eval *in50 = *on C eval *in35 = *on C update sflrcd C ExSr SrReadC
35 is the sflnxtchg indicator
Is it because no typing occured in the subfile record? Ideas?
Software/Hardware used:
AS/400 RPG
ASKED:
December 1, 2010 8:44 PM
UPDATED:
December 3, 2010 4:51 PM
I’m not Tom, but, Yes, if you turn on the indicator for SFLNXTCHG and update the subfile record, it will be available for the next READC.
Phil
Phil’s right, though there can be complications.
From the Application Display Programming (PDF) manual:
From the code snippet you supplied, it’s hard to tell. But the general intention is that SFLNXTCHG applies to UPDATEd subfile records.
You might review Chapter 4. Displaying Groups of Records Using Subfiles, topic Requesting I/O Operations for a Subfile, Requesting I/O Operations for a Subfile Record Format, subtopic Reading the Next Changed Record in a Subfile. Then look over your general logic.
Tom
Thanks Philpl1jb and Tom,
There has to be a better way to paste code so it will not get jumbled. I haven’t found that way yet.
The sflnxtchg indicator is set on, the subfile is updated, and then the routine to READC is executed. The READC indicator is *on at the first read.
I will review the manual and verify that it is correct. But right now, what I am shown and what I see are different.
The READC indicator is *on at the first read.
Is the subfile redisplayed in the SrReadC subroutine? Or does it simply continue reading for the next changed subfile record? After the UPDATE, the subfile position should be immediately after the UPDATEd record. Are there other changed subfile records before EOF? If the subfile hasn’t been redisplayed and there are no additional changed records before EOF, that might be a problem.
To paste code, simply paste it, then select everything that was pasted and then click {code}. The selected text will be more or less cleanly presented when viewed later. Also note that if newlines are not part of what was pasted, then newlines won’t be part of what gets displayed. I tend to paste into Notepad first, to be a little more certain of what the lines will look like.
You can also click {code}, paste text and then click {/code} at the end.
Tom
When control comes back from the window sfl, the SRReadC just loops through without showing the base subfile again. I guess that is where the issue was. I re-arranged the code some and now have to skipping the SRReadC routine and going straight to the db file update roiutine. In other words, update the db file immediatly then show the base subfile again. So, WUSIWUGot in the file.
Now my issue is on the file update. First pass is good. Second pass(after choosing a code from the second subfile window) writes another record. Display the base subfile, comment is entered, back to the db file update routine, write duplicate record.
I just have to do some field checking when I figure a clean, consistant way to do it for all occasions.
Thanks for the code post tip.
Nick