home *** CD-ROM | disk | FTP | other *** search
/ ftp.robelle3000.ai 2014 / 2014.06.ftp.robelle3000.ai.tar / ftp.robelle3000.ai / faq / dbed01.txt next >
Text File  |  1996-03-14  |  4KB  |  104 lines

  1.  Using Dbedit for Mass Updates.
  2.  
  3.  One frequently-requested enhancement for Suprtool comes from users who wish to
  4.  update a dataset from a table of values.  In other words, they have a file
  5.  that contains two fields:  one is the key field of the dataset and the other
  6.  one is the new value for another field in the record.
  7.  
  8.  Currently, Suprtool cannot do this sort of dynamic update in one pass.
  9.  However, Suprtool and Dbedit can be used together to deliver the goods.  The
  10.  trick is to establish the pattern of prompts and responses for Dbedit, and to
  11.  create a file with all the correct responses in the correct sequence.
  12.  
  13.  To run Dbedit, you first need to run Suprtool, enter the Base command, and
  14.  then enter the Edit command to invoke the Dbedit program.  The Modify command
  15.  
  16.       MODIFY dataset:itemname
  17.  
  18.  initiates a series of prompts for keyvalue, new fieldvalue, keyvalue, new
  19.  fieldvalue, and so on.  If the dataset has more than one key, Dbedit prompts
  20.  for all keys (the default).  You can override this default by specifying the
  21.  key field for retrieval in the Modify command:
  22.  
  23.       MODIFY dataset:itemname;key=keyfield
  24.  
  25.  Dbedit continues to prompt until it receives a null (blank) response or a "//"
  26.  when prompting for a new keyvalue.
  27.  
  28.  Start by building a file and initializing it with the required Suprtool and
  29.  Dbedit commands:
  30.  
  31.       :build file1;rec=-60,,f,ascii;disc=1000
  32.       :file file1,old
  33.       :echo  base store,1,writer >> *file1
  34.       :echo  edit >> *file1
  35.       :echo  modify m-customer:cust-status  >> *file1
  36.  
  37.  Now use Suprtool's List command to load a file with the sequence  of  keyvalue
  38.  and  fieldvalue responses to Dbedit's prompts.  Suprtool will send its listing
  39.  to the Suprlist file, which has a default capacity of 1023 records.   If  your
  40.  task is larger than that, it will be necessary to override the file size:
  41.  
  42.       :file suprlist;disc=5000
  43.       :run suprtool.pub.robelle
  44.  
  45.       SUPRTOOL/iX/Copyright Robelle Consulting Ltd. 1981-1996.
  46.       > input custab                    {the "table file"}
  47.       > define acct,1,8
  48.       > define stat,9,2
  49.       > extract acct, stat
  50.       > list oneperline norec noname noskip dev disc
  51.       > xeq
  52.       IN=4, OUT=4. CPU-Sec=1. Wall-Sec=1.
  53.  
  54.  Now append this data to the file that we constructed in the first step:
  55.  
  56.       > in suprlist
  57.       > out file1,append
  58.       > xeq
  59.       Warning:  >OUTPUT has different record size.
  60.       IN=8, OUT=8. CPU-Sec=1. Wall-Sec=1.
  61.       > exit
  62.  
  63.  Our file now contains the commands necessary to start Dbedit and to respond to
  64.  the data prompts. We now need to end the prompt sequence with a blank line,
  65.  then exit Dbedit and Suprtool:
  66.  
  67.       :echo  >> *file1                   {a blank line}
  68.       :echo  exit >> *file1              {exit Dbedit}
  69.       :echo  exit >> *file1              {exit Suprtool}
  70.  
  71.  Finally, run Suprtool using the file as the source of input commands:
  72.  
  73.       :run suprtool.pub.robelle < file1
  74.  
  75.       SUPRTOOL/iX/Copyright Robelle Consulting Ltd. 1981-1996.
  76.       > base store,1,writer
  77.       > edit
  78.  
  79.       DBEDIT/iX/Copyright Robelle Consulting Ltd. 1984-1996.
  80.       Current: <default>
  81.       # modify m-customer:cust-status
  82.       Modify within File: M-CUSTOMER
  83.           CUST-ACCOUNT       >04003302_
  84.       Enter new values (or <return> to leave as is):
  85.           CUST-ACCOUNT       =4003302
  86.            CUST-STATUS       =20
  87.                               XX
  88.       CUST-ACCOUNT    = 4003302        CUST-STATUS     = XX
  89.       Modify within File: M-CUSTOMER
  90.           CUST-ACCOUNT       >44444444_
  91.       Enter new values (or <return> to leave as is):
  92.           CUST-ACCOUNT       =44444444
  93.            CUST-STATUS       =20
  94.                               XX
  95.        ...
  96.  
  97.       Modify within File: M-CUSTOMER
  98.           CUST-ACCOUNT       >_________      {Blank ends prompting}
  99.       # exit
  100.       Return to SUPRTOOL
  101.       Base STORE,1
  102.       > exit
  103.  
  104.