Page 1 of 1

adding a field in ksds

PostPosted: Mon Jul 19, 2010 2:27 am
by white-shadow
hi,
i have to load a ps file in ksds file. so, is it necessary to declare the FD section of both the file same. and if yes then how can we add an extra field in the same ksds.

Re: adding a field in ksds

PostPosted: Mon Jul 19, 2010 3:00 am
by Robert Sample
You do not have the declare the FD for the sequential and VSAM files the same. You can do variable-by-variable MOVE statements if the two layouts are not identical, or you can add extra variables to the end of the VSAM FD 01, do the group level MOVE, then MOVE data into the extra variables individually.

Re: adding a field in ksds

PostPosted: Mon Jul 19, 2010 4:25 am
by white-shadow
i got it but there is still a confusion.
suppose for ps-file
01 ps-rec.
   02 asd     pic x(10).
    02 filler  pic x(10).
   02 xyz     pic x(20).
   o2 filler   pic x(40).
 and for ksds file
 01 ks-rec.
  02 kasd     pic x(10).
  02 filler  pic x(10).
  02 kxyz     pic x(20).
  02 filler   pic  x(10).
  02 qwe    pic x(10).
  02 filler  pic  x(20).


now i have to move the psfile record to ksds file record and then add the qwe field at the end of each record.
will it work or not.
also if the length of ps and the ksds file is different.
thanx for the previous reply

Re: adding a field in ksds

PostPosted: Mon Jul 19, 2010 6:02 am
by dick scherrer
Hello,

You are running yourself around in circles. . .

then add the qwe field at the end of each record.
In the code posted, the qwe field is NOT at the end of the record - it is using some of the filler. . .

will it work or not.
It will if coded correctly.

also if the length of ps and the ksds file is different.
What has been posted is the same length. Again, if you change the definition(s), then the code might need to change, but it will still work if coded correctly.

Re: adding a field in ksds

PostPosted: Mon Jul 19, 2010 7:27 am
by Robert Sample
The key point is that if you code it correctly, the VSAM file record length can be anything up to the maximum (just short of 32K) while the sequential file can also have any length record up to the maximum. If you code it incorrectly, they could have the same length (as in the example you posted) and you'd still have problems. The issue is not one of file record lengths, the issue is one of code quality. Write good code and you won't have a problem no matter what you're attempting to do. Write bad code and even the simplest tasks become quite difficult.