| Navigation: Language Reference > 13 - Built-in Functions >====== RESET (reset record sequence position) ====== | ![]() ![]() |
| RESET | ( **|// view, string//| )** | |||
| // view, file| |
| | | | sequence, string// |
| RESET | Resets sequential processing to a specific record. |
| view | The label of a VIEW. |
| string | The string returned by the POSITION procedure. |
| file | The label of a component file of the VIEW. |
| sequence | The label of a FILE, KEY, or INDEX declaration. |
RESET resets sequential processing to a specific record.
VIEW Usage
RESET restores the VIEW to a previously read position in the return record set.
| RESET(view,string) | Resets to the record identified by the string that was returned by the POSITION procedure. Once RESET has restored the record pointer, either NEXT or PREVIOUS will read that record. |
| RESET(view,file) | Resets to the record identified by the current contents of the file's record buffer. This is used when the order of the VIEW is specified using PROP:Order and is equivalent to a RESET(view,string). |
The value contained in the position string (a value returned by the POSITION procedure) and its length, are file driver dependent. RESET is usually used in conjunction with POSITION to temporarily suspend and resume sequential VIEW processing.
FILE Usage
RESET restores the record pointer to the record identified by the string returned by the POSITION procedure. Once RESET has restored the record pointer, either NEXT or PREVIOUS will read that record.
The value contained in the string returned by the POSITION procedure, and its length, are dependent on the file driver. RESET is used in conjunction with POSITION to temporarily suspend and resume sequential file processing.
Errors Posted:
| 33 | Record Not Available |
| 37 | File Not Open |
| 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)
** END**
SavPosition STRING(260)
** CODE**
** OPEN(Customer,22h)**
** OPEN(Header,22h)**
** OPEN(Detail,22h)**
** OPEN(Product,22h)**
** SET(Cus:AcctKey)**
** OPEN(ViewOrder) !Top of file in keyed sequence**
** 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**
** ADD(RecordQue) ! and add it**
** ASSERT(NOT ERRORCODE())**
** IF RECORDS(RecordQue) = 20 !20 records in queue?**
** DO DisplayQue !Display the queue**
** END**
** END !End loop**
DisplayQue ROUTINE
** SavPosition = POSITION(ViewOrder) !Save record position**
** DO ProcessQue !Display the queue**
** FREE(RecordQue) !and free it**
** **RESET(ViewOrder,SavPosition) !Reset the record pointer
** NEXT(ViewOrder) !and get the record again**
See Also:





