Tom – Subfile post in April

1380 pts.
Tags:
AS/400
AS/400 Subfiles
RPG
SFLNXTCHG
[small _extended="true" class="upper">POSTED:  Apr 21, 2010  8:02 AM (GMT)[/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

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    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
    49,850 pointsBadges:
    report
  • TomLiotta
    Phil's right, though there can be complications. From the Application Display Programming (PDF) manual:
    • If a record retrieved by a get-next-changed operation is updated and the SFLNXTCHG keyword is specified for an updated record, the updated record is set again as a changed record. This allows the program to ensure that the user has changed the record. For example, if the program detects an error in a record, it is advantageous to require the user to correct the error. The use of the SFLNXTCHG keyword allows the program to read that record again on a get-next-changed operation so it can continue to reject the record until the error has been corrected. The next get-next-changed operation does not retrieve this updated record. The record cannot be retrieved again with a get-next-changed operation until all the changed records following it in the subfile have been processed.
    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
    125,585 pointsBadges:
    report
  • NickHutcheson1
    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.
    1,380 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report
  • NickHutcheson1
    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
    1,380 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following