Function order_fetch
This function retrieves the row from the orders table, and is
        designed to be reused each time a row is needed. If the retrieval of the row from the
            orders table is successful, the function items_fetch
        is called to retrieve the corresponding rows from the items
        table.
Function 
order_fetch
            (orders.4gl):01 FUNCTION order_fetch(p_fetch_flag)
02   DEFINE p_fetch_flag SMALLINT
03  
04   IF p_fetch_flag = 1 THEN
05      FETCH NEXT order_curs INTO order_rec.*
06   ELSE
07      FETCH PREVIOUS order_curs INTO order_rec.*
08   END IF
09  
10   IF (SQLCA.SQLCODE == NOTFOUND) THEN
11      RETURN FALSE
12   END IF
13  
14   DISPLAY BY NAME order_rec.*
15   CALL items_fetch()
16   RETURN TRUE     
17  
18 END FUNCTIONNote: 
- Line 
05When the parameter passed to this function and stored in the variablep_fetch_flagis 1, theFETCHstatement retrieves the next row from theorderstable. - Line 
07When the parameter passed to this function and stored inp_fetch_flagis not 1, theFETCHstatement retrieves the previous row from theorderstable. - Lines 
10thru12returnFALSEif no row was found. - Line 
14usesDISPLAY BY NAMEto display the recordorder_rec. - Line 
15calls the functionitems_fetch, to fetch all order lines. - Line 
16returnsTRUEindicating the fetch of the order was successful.