Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

7.59 FETCH

Note
titleNote: Usage options

The FETCH command is used to fetch fields from the first record in a file that matches a nominated key, condition or relative record number.

Portability Considerations

Refer to parameters: FROM_FILE and LOCK

Also See

7.59.1 FETCH Parameters

7.59.2 FETCH Examples

Panel
bgColor#ffffcc

                                                                                                Required

  FETCH ---

Code Block
                                                      Required   FETCH

--------

FIELDS

----------

field name  field attributes

field name   field attributes ------>

                                |           |               | |                                 |            --- 7 max


                                                         |                   |                        |     |
                                                         |                    --- 7 max -----      |

                                |*ALL                         |                                 |*ALL-REAL                    |                                 |*ALL-VIRT                    |                                 |*INCLUDING                   |                                 |*EXCLUDING                   |                                 | expandable group            |                                 


                                                         |*ALL                                           |
                                                         |*ALL-REAL                                  |
                                                         |*ALL-VIRT                                  |
                                                         |*INCLUDING                             |
                                                         |*EXCLUDING                             |
                                                         | expandable group                    |
                                                         |------

1000

max

for

RDMLX----|

                                 -


                                                          -----

-

100

max

for

RDML

------

             >

                       >--

FROM_FILE

------

file

name

.

*FIRST

---------------->

                                            library name  


                                                         library name

 ---------------------------------------------------------------------

                                                         Optional              >-- WHERE

----

                                                                                               Optional

                       >-- WHERE ---------

'condition'

------------------------>

             >


                       >--

WITH_KEY

------

key

field

values

------------------->

                                expandable group expression              >-- IO_STATUS


                                                        expandable group expression

                       >-- IO_STATUS -----

*STATUS

--------------------------->

                                field name              >--


                                                       field name

                      >-- IO_ERROR

-----

*ABORT

---------------------------->

                                *NEXT                                 *RETURN                                  label              >-- VAL_ERROR


                                                     *NEXT
                                                     *RETURN 
                                                      label

                     >-- VAL_ERROR ----

*LASTDIS

--------------------------->

                                *NEXT                                 *RETURN                                 label              >-- NOT_FOUND ---- *NEXT


                                                     *NEXT
                                                    *RETURN
                                                     label

                     >-- NOT_FOUND -- *NEXT ------------------------------>

                                *RETURN                                 label              >-- ISSUE_MSG


                                                     *RETURN
                                                     label

                     >-- ISSUE_MSG ----

*NO

-------------------------------->

                                *YES              >-- LOCK


                                *YES

                     >-- LOCK ----------

*NO

-------------------------------->

                                *YES              >--


                                                    *YES

                    >-- WITH_RRN

-

----

*NONE

------------------------------

>              >

>

                   >--

RETURN_RRN

--

-

*NONE

------------------------------>

             >

                   >--

KEEP_LAST

-----

*NONE

-------------------------------|

                                1 -


                                                   1 - 9999