core

#### 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 c:\temp directory which contains this information on the first line.

root:x:0:0:root:/root:/bin/bash

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,C:\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 ":" (without the quotation marks) as the delimiter.

USERNAME =FILE/READ_UPTO,SAMPLE,:

PASSWORD =FILE/READ_UPTO,SAMPLE,:

USER =FILE/READ_UPTO,SAMPLE,:

Thus, when PC-DMIS executes these lines, it sets

username = root

password = x

user = 0

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

COMMENT/OPER,The following text is read in from sample.txt

,Username:

,USERNAME

,Password:

,PASSWORD

,User:

,USER