User Tools

Site Tools


reget_re_get_record_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== REGET (re-get record) ====== Previous pageReturn to chapter overviewNext page

REGET( sequence, string )

blk2blue.jpg

REGET Regets a specific record.
sequence The label of a VIEW, FILE, KEY, or INDEX declaration.
string The string returned by the POSITION procedure.

The REGET re-reads a previously accessed record.

FILE Usage

black.jpg

REGET reads the record identified by the string returned by the POSITION procedure. The value contained in the string returned by the POSITION procedure, and its length, are dependent on the file driver.

VIEW Usage

black.jpg

REGET reads the VIEW record identified by the string returned by the POSITION(view) procedure. The value contained in the string returned by the POSITION procedure, and its length, are file driver dependent. If the VIEW contains JOIN structures, REGET retrieves the appropriate set of related records.

REGET re-loads all the VIEW component files' record buffers with complete records. It does not perform the relational “Project” operation. REGET(view) is explicitly designed to reset the record buffers to the appropriate records immediately prior to a CLOSE(view) statement. However, the processing sequence of the files must be reset with a SET or RESET statement.

Errors Posted:

35 Record Not Found
37 File Not Open
43 Record Is Already Held
78 Invalid number of parameters (string parameter is too small)

Example:

ViewOrder VIEW(Customer)  !Declare VIEW structure

          PROJECT(Cus:AcctNumber,Cus:Name)

          JOIN(Hea:AcctKey,Cus:AcctNumber) !Join Header file

           PROJECT(Hea:OrderNumber)

           JOIN(Dtl:OrderKey,Hea:OrderNumber) !Join Detail file

            PROJECT(Det:Item,Det:Quantity)

            JOIN(Pro:ItemKey,Dtl:Item) !Join Product file

             PROJECT(Pro:Description,Pro:Price)

            END

           END

          END

         END

RecordQue  QUEUE,PRE(Que)

AcctNumber  LIKE(Cus:AcctNumber)

Name        LIKE(Cus:Name)

OrderNumber LIKE(Hea:OrderNumber)

Item        LIKE(Det:Item)

Quantity    LIKE(Det:Quantity)

Description LIKE(Pro:Description)

Price       LIKE(Pro:Price)

SavPosition STRING(260)

          END

CODE

OPEN(Customer,22h)

OPEN1)

END

ACCEPT

 CASE ACCEPTED()

 OF ?ListBox

  GET(RecordQue,CHOICE())

  REGET(ViewOrder,Que:SavPosition)!Reset the record buffers

  CLOSE(ViewOrder)                !and get the record again

  FREE(RecordQue)

  UpdateProc                      !Call Update Procedure

  BREAK

 END

END

See Also:

POSITION

SET

RESET

WATCH

GET

NEXT

PREVIOUS

1)
Header,22h) OPEN(Detail,22h) OPEN(Product,22h) SET(Cus:AcctKey)  OPEN(ViewOrder) LOOP                              !Read all records in file  NEXT(ViewOrder)                  !read a record sequentially  IF ERRORCODE()   DO DisplayQue   BREAK  END  RecordQue :=: Cus:Record         !Move record into queue  RecordQue :=: Hea:Record         !Move record into queue  RecordQue :=: Dtl:Record         !Move record into queue  RecordQue :=: Pro:Record         !Move record into queue  SavPosition = POSITION(ViewOrder)!Save record position  ADD(RecordQue)                   !and add it  ASSERT(NOT ERRORCODE(
reget_re_get_record_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1