What to do when a KSDS file is defined in the FCT of Enterprise Server MTO and contains secondary keys, but OPEN in a batch processing program will fail for indexed files with a primary and alternate key.
Problem:
I am experiencing a problem where a KSDS file is defined in the FCT of Enterpriser Server MTO and contains secondary keys, but am getting a File Status 39 on OPEN in a batch processing program which fails for indexed files with a primary and alternate key.
Resolution:
In a batch oriented program you need to describe the alternate key, and that duplicates are allowed, if applicable. For example:
SELECT UZ08 ASSIGN '.\\DATA\\UZ08.DAT'
ACCESS IS DYNAMIC
RECORD KEY IS UZ08-PRIME
ALTERNATE KEY IS UZ08-KEY2 WITH DUPLICATES