7.59 FETCH

Note: 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

                                                       Required

 

  FETCH -------- FIELDS ------- field name  field attributes --->

                                |           |               | |

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

                                |*ALL                         |

                                |*ALL-REAL                    |

                                |*ALL-VIRT                    |

                                |*INCLUDING                   |

                                |*EXCLUDING                   |

                                | expandable group            |

                                |------ 1000 max for RDMLX----|

                                 ------- 100 max for RDML ----

 

             >-- FROM_FILE ---- file name . *FIRST ------------->

                                            library name

 

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

                                                         Optional

             >-- WHERE -------- 'condition' -------------------->

 

             >-- WITH_KEY ----- key field values --------------->

                                expandable group expression

 

             >-- IO_STATUS ---- *STATUS ------------------------>

                                field name

 

             >-- IO_ERROR ----- *ABORT ------------------------->

                                *NEXT

                                *RETURN 

                                label

 

             >-- VAL_ERROR ---- *LASTDIS ----------------------->

                                *NEXT

                                *RETURN

                                label

 

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

                                *RETURN

                                label

 

             >-- ISSUE_MSG ---- *NO ---------------------------->

                                *YES

 

             >-- LOCK --------- *NO ---------------------------->

                                *YES

 

             >-- WITH_RRN ----- *NONE -------------------------->

 

             >-- RETURN_RRN --- *NONE -------------------------->

 

             >-- KEEP_LAST ---- *NONE --------------------------|

                                1 - 9999