Searching for a partial match – PSC PT Program Generator User Manual

Page 160

Advertising
background image

Example Frames

148

PT Program Generator (PPG) v5.0

Searching for a Partial Match

A partial match for data in a file may be searched for using the wild card char-
acters “

~

” and “

*” and a

Verify

node. By inserting “

~,

on the front and

appending a

* to the end of a register containing the desired partial match

data and searching the file with that register, the first record with the begin-
ning characters in the second field of the register will be found if one exists.

For example: to look up

Part #

in a comma delimited Default File with

Loca-

tions

and

Prices

by

Part #

such as:

Loc1

,0001,1.00

Loc1

,0010,2.00

Loc2

,0100,10.00

Loc2

,1000,100.00

Loc3

,1001,250.00

enter

1000 at a prompt. To look up the

Price

for

Part #

1000, insert “

~,

” in

front of the register and append a “

*” to the end of the register so the result is:

~

,1000*

Use that register in a

Verify

node as the Comparison type against the Default

File to determine whether there is a match.

To search for a partial match, complete the following steps:

1. Input

Item ID into

Default Register

overwriting.

2. Copy insert “

~,

” into the

Default Register

.

3. Copy append “

*” to the

Default Register

Copy: END

Copies the constant value “end” to the end of the file being checked.

Verify: END

Looks for the constant “end” in the file and stores the index value of the
matching record in a register named INDEX.

Math: INDEX-1

Subtracts 1 from the index value.

Modify: DEL END Deletes the “end” record so that the constant doesn’t corrupt the file.

Output:
POSITION

Positions the cursor at column 8 in the first line, directly after

RECORDS=

.

Output: TOTAL

Displays the index value at the cursor position on the portable screen.

Input: TO EXIT

Waits for a function or data key to be pressed before returning to the
Main frame.

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

Advertising