ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Command function in subfile, accessing buffer value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Command function in subfile, accessing buffer value

    Ok, so this rejoins the issues I had with understanding memory in my other post a few months past. I have a program with a subfile that has two fields (let's call them FIELD1 and FIELD2) that can be filled. I want to put an F4 command function key. When pressing F4 on FIELD1, it should always behave in the same manner. But pressing F4 on FIELD2 should act differently depending on the value of FIELD1 of that subfile record. If FIELD1 is empty, it should act like the user had pressed F4 on FIELD1.

    My issue is that I am unable to have the program take into account the screen value of FIELD1 when pressing F4 on FIELD2. If FIELD1 of a subfile record had a value of 'FIVE' when the subfile was loaded, then I clear the value (without pressing enter), and then press F4 on FIELD2, the program detects the value of 'FIVE'. I am not able to detect the current value of *BLANKS and I'm not sure how to.

    According to IBM, the CFnn keyword should transfer the data from the screen into the input buffer and I should thus have access to it. But because it's a subfile, I'm not sure how it works exactly. All I know is that I cannot detect the value. If I instead read the subfile record by chaining it, then it'd simply overwrite the values in the memory with the values of that record but I still wouldn't have access to *BLANKS.

    I still need to test more tomorrow but any insight would be appreciated.


  • #2
    My 5250 (thankfully) is very rusty, so I'm just grasping here. Have you tried CAnn?

    Comment


    • #3
      CAnn says to discard the user inputs. Usually CAnn is used for a "refresh" function, where the user wants the data to go back the way it started.

      So I think that (in general), CFnn is the right way to see FIELD1 being blank, and not 'FIVE' the way it was originally.

      But I don't know enough about subfiles to know whether the subfile-ness affects CAnn.

      Comment


      • #4
        If I instead read the subfile record by chaining it, then it'd simply overwrite the values in the memory with the values of that record but I still wouldn't have access to *BLANKS.
        When the user changes data in a subfile, they are changing the data in memory. To retrieve the changed data into the program fields, you have to chain to (or read) the subfile record that was changed, that's how you can determine that one of the fields was blanked out by the user. Think of it like a database file, if you read a record from a database file and someone else changes that record, you have to read the record again to retrieve the current values.




        Comment


        • #5
          Ok, thanks for the replies. I'll try it out.

          Comment

          Working...
          X