No announcement yet.

How to tell that a record has been modified in subfile with CHAIN instead of READC

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to tell that a record has been modified in subfile with CHAIN instead of READC

    In certain programs of ours, we have function keys that read the entire subfile (for example, to put a default value in a certain field if the field on that record is empty). When these function keys are pressed, we read the entire subfile doing a chain on each one. However, doing so turns off the modified tag of all records. If the user had input some data onto some records (for example, inputting an option), these records are no longer marked as changed and aren't read with the next READC loop.

    When doing a CHAIN on a subfile record, how can I determine if that record should be marked changed again with SFLNXTCHG? Is there a way to return the value of the modified tag when chaining a subfile record?

    For now, I'm using work-arounds. If an option has been input on a record, I activate SFLNXTCHG since options always set the modified tag on. However, when it's another field of the subfile that turned the modified tag on, I don't always have a method of determining if I need to activate SFLNXTCHG or not when chaining this record.


  • #2
    Personally after the appropriate function key is pressed I think I would would run the TREADC loop to find the changes and _then_ run the CHAIN (why not just read?) loop to process for the missing fields


    • #3
      Huh. I hadn't thought of that. Yeah, I guess that's the best way to deal with it. I wasn't aware we could read a subfile with READ. I'm pretty sure you have to chain to the RRN of each record.


      • JonBoy
        JonBoy commented
        Editing a comment
        I've never tried I admit but I'd expect SETLL and READ to work.

    • #4
      Use the CHANGE(xx) keyword at the record level in the subfile record, then test to see if the indicator is on when you chain (or read) the subfile record. If it's on it means that one of the fields in the subfile record has changed so you can update that record with SFLNXTCHG activated.