Sample code for EOF and EOL

The sample code below should be entered inside the Edit window's Command mode and not inside the File I/O dialog box.

The following code opens test.txt and reads through the file. As long as the end of file hasn't been reached (designated with the code, WHILE/!EOF), PC-DMIS reads through the file character by character, and assigns a character to V1.

If PC-DMIS reaches the end of a line in the file, PC-DMIS shows the last character on that line.

This repeats until PC-DMIS reaches the end of the file. PC-DMIS then shows the text "End of File Reached…".

FPTR=FILE/OPEN,D:\temp\test.txt,READ

WHILE/!EOF("FPTR")

V1=FILE/READ_CHARACTER,FPTR

IF/EOL("FPTR")

COMMENT/OPER,NO,"End of Line Reached. The last character is:"

,V1

END_IF/

END_WHILE/

COMMENT/OPER,NO,"End of File Reached..."

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.