Getting Started with TRANSACT (32247-90007)

24 Chapter1
Getting Started
Sorting the Data
Here is an example of running the program listed in Figure 1-9.
Figure 1-10. Report of Selected Data
Setting up match criteria and serially reading datasets and files will work against any
kind of file. However, in the case of Image, we can take advantage of search keys to retrieve
the data more rapidly. Cust-no happens to be a search key in the orderhead dataset. Thus
we can retrieve the data desired more rapidly if we change the program to the following:
Figure 1-11. Program to Select Data by Key Value
4 The retrieval is to be by the dataset key cust-no. The value of the cust-no is
requested from the user in line 3.
5 The retrieval is to be done by Image CHAINed reads.
These examples show how a single input value can be used to qualify or select data.
However, with a slight change, we can put the data selection logic into the hands of the
user. Doing so allows a single program to be used to select data on the basis of any number
of selection criteria entered by the user.
CUST-NO> 1
ORDER-NO: CUST-NO: ORDER-STATUS: ORDER-DATE:
po1001 1 o 850101
po1002 1 o 850203
po1003 1 o 850127
po1004 1 o 850301
po1005 1 c 850212
5 RECORDS FOUND
EXIT/RESTART(E/R)?>
1 system ex4,base=orders;
2 list(auto) orderhead;
3 data cust-no;
4 set(key) list (cust-no);
5 output(chain) orderhead;