sponsored links



No announcement yet.

Regarding Readc

  • Filter
  • Time
  • Show
Clear All
new posts

  • Regarding Readc

    My manager likes to quiz us to see how much we are trying to grasp this language. He asked me a question recently:

    "You do not specify SFLNXTCHG and it's indicator in the subfile. On compiling the display file and the program, you make a change on the subfile and the program reads the change through readc. You make a change again but this time the program doesn't pick up the change. Why?"

    I replied by saying it's because we didn't define SFLNXTCHG in the subfile and didn't turn it on after the program executes readc the first time.

    So he then asked why do we need to specify and turn SFLNXTCHG on? Shouldn't readc read the changed record the second time if it's job is to read the changed records?

    I couldn't find the answer yet. Any help would be really appreciated.

  • #2
    Maybe I'm being too literal about the way you've phrased it, but... if you make a change again, READC will indeed pick up the change.

    Normally SFLNXTCHG is used in a situation where you want to read the changed records more than once. For example, the user changes records, and you run through them all and validate everything that was changed. Maybe there are errors that now need to be displayed, or maybe you've updated a description or filled in some other data on the screen, and want to re-display it for the user. So you do that. Now the records are not longer "changed" because you've already read them once. If the user doesn't make changes again and submits the screen, how will you know which rows they originally changed?

    That's what SFLNXTCHG is for. The program can mark the record changed again so that they remain "changed" even after sending the screen back to the user and the user not changing them again. This way you can keep track of all changes since the start, and can use that to update a database table (or whatever it is that you plan to do with the data.)


    sponsored links