GETLINK
Get the next linked detail record.

Format
 Getlink [expr] using LINK-TAG [/Qualifiers ...]
 exprNumber of the detail link to get. If "expr" is not specified, GELINK gets the next linked detail record skipping any deleted records or links.
 LINK-TAGName tag of the link file.
 If the current record for this database has been modified, it is written back to the record stream before any other record operation takes place. If an error occurs during this write-back operation (e.g. duplicate key, record not locked for write, etc.) an error is generated for this statement. The record remains current, but is now considered to be unchanged so that the next record operation will not attempt another write-back.
 NOTE
 The OPENLINK, GETLINK, LINK and DELINK statements are to support UserBase format datafiles. If you are using RMS datafiles, you should not need to use these statements. Use the RMS key structure instead.

Qualifiers
/Fail=LABELLabel to which to branch if the statement fails.
If LABEL is %EXIT, exit the routine or loop.
If in a loop, and LABEL is %CONTINUE, continue the loop. If not in a loop, and LABEL is %CONTINUE, an error message displays.
 /Succeed=LABELLabel to which to branch if the statement succeeds.
If LABEL is %EXIT, exit the routine or loop. If in a loop, and LABEL is %CONTINUE, continue the loop. If not in a loop, and LABEL is %CONTINUE, an error message displays.
 /NofailDo not signal an error. Instead, set the
internal variable %FAIL.
 /FlushFlush the record stream so that the record is physically on disk.
 /LoadUse the load factor of the RMS datafile if specified.
 /Lock=(lock_options, ... )Use the following lock options to lock the record if it is automatically retrieved (by accessing a field in that record).
 exclusiveLock against all other record streams except READ_REGARDLESS.
 manualRecords remain locked until explicitly unlocked.
 noneRecords are not to be locked.
 nonexistentProceed with the operation even if the record does not exist (RMS relative files only).
 nowaitDo not wait if the record is locked (return an error).
 readLock the record for reading while allowing other record streams to read but not modify (ignored if write also specified).
 read_regardlessRead records even if another record stream has them locked.
 wait=nWait n seconds before returning an error if the record is locked.
 writeLock the record for writing while allowing other record streams to read but not modify.

Example
 Openlink EMPLOYEES(LINK) &
 for HOURS as HOURSLINK /Write
 ! Open the Link file with
 ! write access.
 Gosub PROCESSING
 Getlink lrec using HOURSLINK
 Perform DISPLAY
 ! Get the link specified
 ! and display the HOURS record.
 Menu ACTION
 ! Ask what to do with it
 If %ITEM = "DELETE" then
 Delink using HOURSLINK
 ! "Unlink" it if required.
 End_if
 If %item = "DUPLICATE" then
 Link using HOURSLINK
 ! Link it again if required
 ! (one HOURS record, two links)
 End_if