Suprtool has a feature called Update-From-Table that allows you to update a dataset from a table of values. In other words, you have a file that contains two fields: one is the key field of the dataset and the other one is the new value for another field in the record.
However, there is another way to do such "mass updates" using the Dbedit module.
The trick is to establish the pattern of prompts and responses for Dbedit, and to create a file with all the correct responses in the correct sequence.
To run Dbedit, you first need to run Suprtool, enter the Base command, and then enter the Edit command to invoke the Dbedit program. The Modify command
MODIFY dataset:itemname
initiates a series of prompts for keyvalue, new fieldvalue, keyvalue, new fieldvalue, and so on. If the dataset has more than one key, Dbedit prompts for all keys (the default). You can override this default by specifying the key field for retrieval in the Modify command:
MODIFY dataset:itemname;key=keyfield
Dbedit continues to prompt until it receives a null (blank) response or a "//" when prompting for a new keyvalue.
Start by building a file and initializing it with the required Suprtool and Dbedit commands:
:build file1;rec=-60,,f,ascii;disc=1000 :file file1,old :echo base store,1,writer >> *file1 :echo edit >> *file1 :echo modify m-customer:cust-status >> *file1
Now use Suprtool's List command to load a file with the sequence of keyvalue and fieldvalue responses to Dbedit's prompts. Suprtool will send its listing to the Suprlist file, which has a default capacity of 1023 records. If your task is larger than that, it will be necessary to override the file size:
:file suprlist;disc=5000 :run suprtool.pub.robelle SUPRTOOL/iX/Copyright Robelle Solutions Technology Inc. 1981-1996. > input custab {the "table file"} > define acct,1,8 > define stat,9,2 > extract acct, stat > list oneperline norec noname noskip dev disc > xeq IN=4, OUT=4. CPU-Sec=1. Wall-Sec=1.
Now append this data to the file that we constructed in the first step:
> in suprlist > out file1,append > xeq Warning: >OUTPUT has different record size. IN=8, OUT=8. CPU-Sec=1. Wall-Sec=1. > exit
Our file now contains the commands necessary to start Dbedit and to respond to the data prompts. We now need to end the prompt sequence with a blank line, then exit Dbedit and Suprtool:
:echo >> *file1 {a blank line} :echo exit >> *file1 {exit Dbedit} :echo exit >> *file1 {exit Suprtool}
Finally, run Suprtool using the file as the source of input commands:
:run suprtool.pub.robelle < file1 SUPRTOOL/iX/Copyright Robelle Solutions Technology Inc. 1981-1996. > base store,1,writer > edit DBEDIT/iX/Copyright Robelle Solutions Technology Inc. 1984-1996. Current: <default> # modify m-customer:cust-status Modify within File: M-CUSTOMER CUST-ACCOUNT >04003302_ Enter new values (or <return> to leave as is): CUST-ACCOUNT =4003302 CUST-STATUS =20 XX CUST-ACCOUNT = 4003302 CUST-STATUS = XX Modify within File: M-CUSTOMER CUST-ACCOUNT >44444444_ Enter new values (or <return> to leave as is): CUST-ACCOUNT =44444444 CUST-STATUS =20 XX ... Modify within File: M-CUSTOMER CUST-ACCOUNT >_________ {Blank ends prompting} # exit Return to SUPRTOOL Base STORE,1 > exit