Joined: 25 Jul 2019 Posts: 2 Location: Repulic of Korea
I'm working on testing cobol compiler for Linux system(like MFCOBOL) as writing simple cobol program which reads and writes KSDS data.
I need to verify several cases where alternate key is defined on the dataset to identify exact specification of IBM cobol.
Could you help me to find out the expected result of Mainframe for the following cases?
case 1) In FILE CONTROL section, "ALTERNATE RECORD KEY IS WITH DUPLICATES" is specified.
1-1) create AIX with UNIQUEKEY attribute -> I think it would not be run correctly, but if READ/WRITE is performed for this kind of case, which is the expected result, return code of VSAM/cobol/JOB ?
1-2) create AIX with NONUNIQUEKEY attribute -> As far as I know, in this case VSAM file return code would be '02', please let me know if I'm wrong.
case 2) In FILE CONTROL section, "ALTERNATE RECORD KEY IS" (without duplicates) is specified.
2-1) create AIX with UNIQUEKEY attribute -> As far as I know, in this case VSAM file return code would be '22', please let me know if I'm wrong.
2-2) create AIX with NONUNIQUEKEY attribute -> I think it would not be run correctly, but if READ/WRITE is performed for this kind of case, which is the expected result, return code of VSAM/cobol/JOB ?
I couldn't find official manual description for these kinds of cases, so I'd like to ask your knowledge to find out real Mainframe's specification.
If there are any articles which describes the usage of AIX through cobol program, please let me know its link.
Furthermore, if you can have a simple test on Mainframe, I can give you the sample code for each case.
Joined: 06 Jun 2008 Posts: 8551 Location: Dubuque, Iowa, USA
I think your post suffers greatly from fuzzy thinking. You need to be clearer about what you're asking -- KSDS with alternate index can have READ / WRITE on primary key or alternate key (so you've got at least 4 different situations that you've squashed into 1).
Case 1-1: most likely the OPEN statement would get a file status '39' and any READ / WRITE statements would most likely get file status '47' or '48'
Case 1-2: are you reading with the primary key or the alternate key? For the primary key, you would not get a file status '02' reading nor writing
Case 2-1: file status '22' is only for WRITE / REWRITE
Case 2-2: OPEN would get a file status '39' and I/O statements should get a file status '47' or '48' (or even '49' if DELETE is attempted)