Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall POSRFA(channel, rfa[, krf])
The number of the open channel. (n)
The previously saved file position (as returned by the GETRFA subroutine) that will be restored. (a6)
(optional) The key of reference. (n)
POSRFA works in conjunction with the GETRFA routine. Once the current position in an ISAM file has been saved using GETRFA, POSRFA can restore that position. Synergy DBL stores the file position returned from GETRFA in binary form to be used as the rfa argument to POSRFA.
POSRFA is available only for consistency with DBL version 4. It has been superseded by the RFA qualifier on I/O statements like READ, FIND, STORE, and so forth.
The contents of rfa are a special binary value and must be preserved. Be careful in doing assignments or moving the contents into another variable.
If the record at a saved position has been deleted, you’ll get an “Invalid record’s file address” error ($ERR_INVALRFA) on OpenVMS. If an RFA refers to a deleted record, a “Deleted record” error ($ERR_DELREC) will be generated when a read is attempted.
If the channel is opened to an ISAM file and you don’t specify krf, the POSRFA subroutine sets the key of reference to the primary key. All subsequent I/O operations access that key until it is explicitly changed by a READ, a FIND, or another call to POSRFA.
On OpenVMS, if you specify a nonzero krf value, Synergy DBL generates an “Invalid operation for file type” error ($ERR_FILOPT). You can use the POSRFA subroutine on any file type. The rfa variable must be declared as data type a6.
The following subroutine creates a temporary tag file to sort data from an ISAM file that is in a nonkey field. It reads through the file searching for records with a nonblank entry in the nonkey field. It then creates a temporary tag file and saves the RFA position of the ISAM file and the nonblank field. It sorts the temporary file using the nonblank field as the sort key, then extracts the appropriate records from the ISAM file in sorted order to pass to a print subroutine.
subroutine report .define ISMCHN ,10 .define TAGCHN ,11 .define TAGFILE ,"tagfile" record ism_rec key ,a10 ism_fld ,a5 record tag_rec tag_rfa ,a6 tag_sort ,a5
proc open(ISMCHN, i:i, "isam") open(TAGCHN, o, TAGFILE) repeat begin reads(ISMCHN, ism_rec, done1, GETRFA:tag_rfa) if (ism_fld) begin tag_sort = ism_fld puts(TAGCHN, tag_rec) end end
done1, close TAGCHN sort(input=TAGFILE, key=tag_sort, record=tag_rec, & options="recsize=11/e") open(TAGCHN, i, TAGFILE) repeat begin gets(TAGCHN, tag_rec, done2) xcall posrfa(ISMCHN, tag_rfa) reads(ISMCHN, ism_rec) xcall print_it(ism_rec) end
done2, close TAGCHN close ISMCHN xreturn endsubroutine