7.124.2 UPD_ENTRY Comments / Warnings

UPD_ENTRY is a "mode sensitive" command when being used with a browse list. Refer to RDML Screen Modes and Mode Sensitive Commands for details.

IBM i and CPF operating system restrictions prevent logic like the following example from ever working correctly on two (or more) browse lists:

     SELECTLIST NAMED(#LIST01)
<< process LIST01 entry >>
           SELECTLIST NAMED(#LIST02)
          << process LIST02 entry >>
          UPD_ENTRY  IN_LIST(#LIST02)
          ENDSELECT
UPD_ENTRY IN_LIST(#LIST01)
         ENDSELECT

The reason is that all browse lists belong to the same "file" (ie: display file) and therefore the update implicitly attempts to update the last "record" processed in the "file". If a program like this example was compiled, it would fail on the UPD_ENTRY command to #LIST01 with an error indicating an update was attempted "without a prior read".

In other words, you can only update a browse list entry if the last operation performed on any browse list was a read operation against the browse list that is being updated (ie: SELECTLIST or GET_ENTRY).

This restriction can usually be overcome by altering the point at which the update operation is performed like this:

     SELECTLIST NAMED(#LIST01)
  << process LIST01 entry >>
=> UPD_ENTRY IN_LIST(#LIST01)
             SELECTLIST NAMED(#LIST02)
              << process LIST02 entry >>
              UPD_ENTRY  IN_LIST(#LIST02)
              ENDSELECT
  ENDSELECT

If a solution like this cannot be implemented, use a GET_ENTRY command immediately before the UPD_ENTRY command.

This restriction does not apply to working lists.

  • No labels