Sets the relative-record-number field of a file control block (FCB) to correspond to the current file position as recorded in the opened FCB.
Call with:
AH = 24H
DS:DX = segment:offset of previously opened file control block
Returns:
AL is destroyed (other registers not affected)
FCB relative-record field (offset 21H) updated
Notes:
This function is used when switching from sequential to random I/O within a file. The contents of the relative-record field (offset 21H) are derived from the record size (offset 0EH), current block (offset 0CH), and current record (offset 20H) fields of the file control block.
All four bytes of the FCB relative-record field (offset 21H) should be initialized to zero before calling this function.
Example:
After a series of sequential record transfers have been performed using the file control block myfcb, obtain the current relative-record position in the file and leave the record number in DX.
myfcb db 0 ; drive = default
db 'MYFILE ' ; filename, 8 chars
db 'DAT' ; extension, 3 chars
db 25 dup (0) ; remainder of FCB
.
.
.
mov dx,seg myfcb ; make FCB addressable
mov ds,dx
; initialize relative
; record field to zero
mov word ptr myfcb+21h,0
mov word ptr myfcb+23h,0
; now set record number
mov ah,24h ; function number
mov dx,offset myfcb ; address of FCB
int 21h ; transfer to MS-DOS
; load record number in DX
mov dx,word ptr myfcb+21h
.
.
.