beautypg.com

Register example: parsing data, Files – PSC PT Program Generator User Manual

Page 93

background image

Files

User’s Guide

81

Register Example: Parsing Data

You own a catalog business. When you ship packages out, you scan a label that
includes the destination region. The first character of each label identifies this
destination region as

North, West, South, or East. Customize the appli-

cation so it divides data into four separate files by region.

Create a template that separates the scanned data into two fields, the first one
for the

region

character and the second one for the

rest

. The template exam-

ines the

region

field to determine the file into which the scanned data should

be copied:

North, West, South, or East.

To create this template, complete the following steps:

1. Create a template called

Region

containing the following fields:

Region

, fixed length:1

Rest

, variable length, comma delimited

2. Create a

Verify

node that uses the

Region

template to determine

whether the character in the

Region

field is

N and, if it is, proceeds to

a

Copy

node that copies the contents of the input register to a file

called

North.

3. Create a second

Verify

node that checks whether the character is

W

and, if it is, copies the input code to a file called

West.

4. Create a third

Verify

node that checks whether the character is

S and,

if it is, copies the input code to a file called

South.

5. Create a fourth

Verify

node that checks whether the character is

E

and, if it is, copies the input code to a file called

East.

Files

Portable files are used to store data that has been either input via the portable’s
scanner or data keys or downloaded from a PC file through the serial port.
Each entry in a file is called a record, and the records in each file are num-
bered, with 1 as the first record.

There are two types of file settings in portable dialog boxes. Source file settings
specify a file or record in a file to be read from. Destination file settings deter-
mine a file or record to be written to.

2342.book Page 81 Thursday, July 22, 2004 8:35 AM