View previous topic :: View next topic
|
Author |
Message |
ranjani Warnings : 1 New User
Joined: 25 Oct 2006 Posts: 13
|
|
|
|
hello everyone
i have a cobol program
Code: |
FILE-CONTROL.
SELECT FILE1 ASSIGN TO FILEIN
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS CRSID
ALTERNATE RECORD KEY IS CNAME
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD FILE1.
01 FILE-REC.
05 CRSID PIC X(10).
05 CNAME PIC X(20).
05 CADDR PIC X(40).
05 CPHONE PIC X(10). |
and in my procedure division
Code: |
OPEN INPUT FILE1.
IF FS1 NOT = '00'
THEN
DISPLAY 'OPEN ERROR= ' FS1
STOP RUN
END-IF.
READ FILE1 KEY IS CRSID.
DISPLAY CRSID ',' CNAME ','.
READ FILE1
KEY IS CNAME.
IF FS1 = ZEROS
THEN
DISPLAY 'READ SUCCESSFUL'
DISPLAY 'RECORD IS ' CRSID SPACE CNAME SPACE
CADDR SPACE CPHONE
ELSE
DISPLAY 'READ ERROR ' FS1
END-IF. |
i am first trying to read the file with crsid as the key (which is my primary key) and then using then using the value stored in cname (my alternate key), i am trying to read the file again... It gives me a VSAM return code '23'...saying invalid key. I dont understand...can someone explain me why
thanks in advance |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
Hi
I think the reason could be you have not moved any value to the key before reading the file. Move some valid value to the key and read the file.
Aji Cherian |
|
Back to top |
|
|
suresh_cit
New User
Joined: 09 Oct 2006 Posts: 1
|
|
|
|
Hi,
Try like this.. It will work.
Code: |
1100-READ-PARA.
READ TRANSIN RECORD AT END GO TO 3000-CLOSE-PARA.
MOVE EMPID TO MAS-EMPID.
READ MASTER RECORD KEY IS MAS-EMPID.
PERFORM 2000-MAIN-PARA.
1100-READ-EXIT-PARA. |
|
|
Back to top |
|
|
ranjani Warnings : 1 New User
Joined: 25 Oct 2006 Posts: 13
|
|
|
|
thanks !!! i did find the error...my alternate key length was declared wrongly |
|
Back to top |
|
|
|