home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol079 / update.pli < prev    next >
Text File  |  1984-04-29  |  1KB  |  67 lines

  1. update:
  2.     proc;
  3.     /* update mode */
  4.     %replace
  5.         true  by '1'b,
  6.         false by '0'b;
  7.  
  8.     %include 'attrib.dcl';
  9.  
  10.     %include 'key.dcl';
  11.  
  12.     dcl
  13.         data  file,
  14.         sysin file,
  15.         rec   char(max_siz);
  16.     dcl
  17.         i fixed,
  18.         answer char(2) var;
  19.     dcl
  20.         open_data   entry,
  21.         close_data  entry,
  22.         input_key   entry(char(max_siz)),
  23.         locate_key  entry(char(max_siz)) returns(bit),
  24.         alter_rec   entry(char(max_siz)),
  25.         att_len     entry(fixed) returns(fixed),
  26.         hdr_out     entry(fixed),
  27.         att_out     entry(fixed,char(max_siz)),
  28.         att_in      entry(fixed,char(max_siz)) returns(bit),
  29.         att_err     entry;
  30.  
  31.     on endfile(sysin)
  32.         go to end_upd;
  33.  
  34.     call open_data();
  35.  
  36.     put edit('Update Mode','')(skip,a);
  37.         do while(true);
  38.         /* read next request */
  39.         put skip;
  40.         call input_key(rec);
  41.         if locate_key(rec) then
  42.             do;
  43.                 do i = 2 to att_cnt;
  44.                 change_field:
  45.                     proc;
  46.                         do while(true);
  47.                         call hdr_out(i);
  48.                         call att_out(i,rec);
  49.                         if att_in(i,rec) then
  50.                             return;
  51.                         call att_err();
  52.                         end;
  53.                     end change_field;
  54.                 call change_field();
  55.                 end;
  56.             put edit('Ok to Change (y/n)?')
  57.                 (column(4),a);
  58.             get list(answer);
  59.             if answer = 'y' then
  60.                 call alter_rec(rec);
  61.             end;
  62.         end;
  63.  
  64.     end_upd:
  65.     call close_data();
  66.     end update;
  67.