Page 1 of 1

Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 4:33 pm
by vkumarg3
Hi,

I have KSDS file with few keys. i want to copy the same VSAM file to an another VSAM file. While copying i want to update one record based on key.

This should be done by jcl.

example:
ctrl card            date
123                   01122012
124                   02122012
125                   03122012


In my scenario i know ctrl card to update. It is 124.. date to be update 02122013

So after copied to new file, new file should look like below.
ctrl card            date
123                   01122012
124                   02122013
125                   03122012


this should be done in jcl. Please help. Thanks in advance.

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 6:00 pm
by Robert Sample
What you want cannot be done, period. All JCL does is execute programs and allocate files. If you had said you wanted to use a program (such as SORT or writing COBOL code) to do so, then what you want to do would be possible.

Furthermore, you did not provide any information about how your input is changed to create your output -- it could have been changed by date, or because it is the second record, or because of the key value, or whatever. You did not provide any such information, so any answers you get can only be guesses.

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 6:37 pm
by c62ap90
If I were doing this task I would…

Copy original VSAM file to sequential file.
i.e. IDCAMS REPRO INFILE(Input) OUTFILE(Output)

Use sort, Easytrieve, whatever (I do not know your shops tools) to make your changes.
Output from above for you input, and create a new output.

Create your new VSAM file using the new output from above.
IDCAMS DEFINE, then IDCAMS REPRO to copy to new VSAM file.

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 7:00 pm
by NicC
Sort can read the old, do the change and write the new. But whichever way JCL cannot do it - only facilitate the exercise.

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 8:13 pm
by vkumarg3
Hi NicC,

Pls tell the sort card to replace that position.

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 9:30 pm
by dick scherrer
Hello,

You need to post the rules for which record(s) to change . . .

Re: Need to update VSAM through JCL

PostPosted: Thu Aug 08, 2013 10:15 pm
by BillyBoyo
  INREC IFTHEN=(WHEN=(X,X,CH,EQ,C'XXX'),
                 OVERLAY=(X:C'XXXXXX'))


It'll be something like that, but you'll need to fix-up all the Xs if you're keeping it all to yourself.