Navigation: ABC Library Reference > FileManager > FileManager Methods >====== TryPrevious (try to get previous record in sequence) ====== | |
TryPrevious, PROC
The TryPrevious method gets the previous record in sequence. The TryPrevious method does not attempt to handle errors that occur while getting the previous record.
The Previous method provides a slightly different (automatic) alternative for getting records in sequence.
Implementation:
TryPrevious tries to get the previous record. If it succeeds, it returns Level:Benign (declared in ABERROR.INC). If it fails, it returns the severity level of the error it encountered while trying to get the record. See Error Class for more information on severity levels.
Return Data Type: BYTE
Example:
PROGRAM BatchReport !batch report–don't display errors
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
END
CODE
!program code
LOOP !loop through client file
CASE Access:Client.TryPrevious() !get previous record in sequence
OF Level:Notify OROF Level:Fatal !if error occurred
POST(Event:CloseWindow) !shut down
BREAK
ELSE !otherwise
PRINT(Rpt:Detail) !print the record
END
END