[comp.os.vms] In need of an UPDATE DCL_Prog....

CRUZ_MIV@CTSTATEU.BITNET (07/16/88)

Dear INFO-Vaxers:

        I am in great need of a prog that will Open a sequencial file of
constant record length and will update it by Inquiring a 'search key',
dispaying that record on the screen, and asking the user to type in the
modified record (new-record), thus updating the file. The file is of text
format. Here is an example of what I was looking for:

          Enter Record Key : Payroll
0112 4567 ext.3456 Payroll  DEC II   LN5678   Jim Brown   Building C  CCSU
Is it this one [Y/N] ? Y
New REC: *typed changes*
Record was updated
*file is closed*

        I was able to write one that reads in record by record, but am having
some trouble in using a search routine to get me to the record I want to
change...

        Can anyone help me ? Make suggestions, or send me a working prog that
does this or similar... I appreciate all the help.

                                   Sincerely,

                                              Mig.
                                                   [CRUZ_MIV@CTSTATEU]

Disclaimer:
             "Kindness is the oil that takes the friction out of life !"

cfchiesa@bsu-cs.UUCP (Christopher Chiesa) (08/05/88)

In article <8808040024.AA09457@ucbvax.berkeley.edu>, CRUZ_MIV@CTSTATEU.BITNET writes:
> 
> Dear INFO-Vaxers:
> 
>         I am in great need of a prog that will Open a sequencial file of
> constant record length and will update it by Inquiring a 'search key',
> dispaying that record on the screen, and asking the user to type in the
> modified record (new-record), thus updating the file. The file is of text
> format. Here is an example of what I was looking for:
> 
  [example deleted]

>         I was able to write one that reads in record by record, but am having
> some trouble in using a search routine to get me to the record I want to
> change...


I'm not quite sure what you're asking here, vis-a-vis "using a search routine
to get me to the record I want..." etc.  If you have a unique "key" for each
record, and want to select your record BY the value of that key, then you
can't do it on a "sequential" file.

You'll have to create an INDEXED file, with a "key" defined at the appropriate
position-and-length in the record.  The easiest way I've found to do this is
to "invoke a script" within the FDL Editor (EDIT/FDL at the DCL command prompt)
and answer the resulting questions.  (I found that I just "took the defaults"
on a lot of parameters I didn't quite understand, and it worked all right.)

Once you've got the FDL file, you can use CONVERT/FDL to transfer the contents
of your existing sequential data file into the Indexed file.  Once THAT's been
done, you can use READ/KEY (and/or /INDEX) in DCL to pull up the exact record
you want in one fell swoop.  Process it just as you want, rewrite it to the
file, etc.  Watch out for changing the "key" value, though.

This is a very terse outline of the procedure, but it will do what you want
once you get it set up.

Let me know via e-mail if you want more details; I've kind of worked this out
on my own so it's PRACTICAL experience.  (As for those of you who would say
"RTFM," well, that's the FIRST thing I tried and it was impossibly cryptic,
so I forged ahead and just plain got it working.)

Cheers,

  Chris


-- 
UUCP: <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!cfchiesa 
cfchiesa@bsu-cs.UUCP