Navigation: ABC Library Reference > FileManager > FileManager Methods >====== TryNext (try to get next record in sequence) ====== | |
TryNext, PROC
The TryNext method gets the next record in sequence. The TryNext method does not attempt to handle errors that occur while getting the next record.
The Next method provides a slightly different (automatic) alternative for getting records in sequence.
Implementation:
TryNext tries to get the next 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 process–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:Cliet.TryNext() !get next 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