Shanu Dutta
Shanu Dutta

Reputation: 51

Can writing to an output ksds be done if we use alternate key concept with dynamic access mode in a input ksds?

I have an input KSDS file, i am using emp-id as primary key and emp-dept as alternate key, with access mode as dynamic. I am reading the file using dynamic access base upon the alternate key, in runjcl i am using base ksds file and ksds path file, so normally cobol will read from the path file (which is sorted based upon the alternate key not the primary key).

but problem is while i am writing to an output ksds it is showing file status 21 error, because in ksds record can only be inserted if it is sorted based upon the primary key, so what to do? is there any other alternate method??

Upvotes: 0

Views: 583

Answers (1)

Bruce Martin
Bruce Martin

Reputation: 10543

Why not

  1. Write the output to a normal Sequential file
  2. Sort copy the sequential file into the output VSAM file.

If updating an existing file, you should be able to update the file. Alternatively you can always use 2 programs and sort the output from the first program.

Does the output file really need to be a VSAM file ???.

Upvotes: 2

Related Questions