The sample code below should be entered inside the Edit window's Command mode and not inside the File I/O dialog box.
This example opens a previously-closed file, uses a previous file pointer, and recalls the stored file pointer's saved position. It then reads in data from that position. This code illustrates the use of the FILE/RECALL_POSITION command. It continues the code sample given in the "Sample Code for Save File Position" topic.
COMMENT/OPER,The routine will now recall the stored file position.
FPTR=FILE/OPEN,C1.INPUT,READ
FILE/REWIND,FPTR
COMMENT/OPER,To test, file has been rewound.
,The first line will be read in to test the rewind.
V3=FILE/READLINE,FPTR,{LINE}
COMMENT/OPER,The first line is:
,LINE
FILE/REWIND,FPTR
FILE/RECALL_POSITION,FPTR
COMMENT/OPER,Previously stored file position has been recalled.
,Data on the line at the stored position will now print.
V4=FILE/READLINE,FPTR,{STORED}
COMMENT/OPER,The text at the stored position is:
,STORED
Code Explanation
This code is similar to that explained in "Sample Code for Rewind to Start".
Only explanations unique to this example are given here.
FILE/RECALL_POSITION,FPTR
This line recalls the stored file pointer position in the file stream for
the file pointer designated as FPTR.
V4=FILE/READLINE,FPTR,{STORED}
This line reads in the next line after the stored file pointer position
and assigns it to the user-defined variable of STORED.
This variable is then printed out in the next operator comment.
Command Mode Commands after Comments
After you insert a PC-DMIS comment, to type additional PC-DMIS commands in Command Mode, you must first press Enter twice after the COMMENT command. This tells PC-DMIS that you no longer want to add text to the comment but are ready to add a new command.