Sample Code for Read Up To

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

Consider this example where you have a text file named "sample.txt" in your D:\Temp directory which contains this information on the first line.

CIR1:2.54:CIRCLE

To use the Read Up To command on this file:

  1. Insert a FILE/OPEN command in the Edit window.

  2. Use a File Pointer Name of your choice to name your File Open command. This example uses "sample" as the file pointer name.

The File Open command should look something like this:

SAMPLE     =FILE/OPEN,D:\TEMP\SAMPLE.TXT,READ

Now, use PC-DMIS Read Up To commands to define some variables that call different segments of data. This example uses the following variables looking for a colon character ":" (without the quotation marks) as the delimiter.

V_LABEL   =FILE/READ_UPTO,SAMPLE,:
V_VALUE   =FILE/READ_UPTO,SAMPLE,:
V_TYPE    =FILE/READ_UPTO,SAMPLE,:

Thus, when PC-DMIS executes these lines, it sets these variables to hold these values:

To display this on screen during execution, you can use an operator comment such as the one shown here:

            COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
            The following text is read in from sample.txt:
            Feature Label:
            V_LABEL
            Measured Value:
            V_VALUE
            Feature Type:
            V_TYPE

Resulting Comment from example code for Read Up To

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.