IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VSAM File Status '23' - invalid key


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ranjani
Warnings : 1

New User


Joined: 25 Oct 2006
Posts: 13

PostPosted: Thu Oct 26, 2006 7:05 am
Reply with quote

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
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Oct 26, 2006 10:39 am
Reply with quote

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
View user's profile Send private message
suresh_cit

New User


Joined: 09 Oct 2006
Posts: 1

PostPosted: Thu Oct 26, 2006 1:36 pm
Reply with quote

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
View user's profile Send private message
ranjani
Warnings : 1

New User


Joined: 25 Oct 2006
Posts: 13

PostPosted: Fri Oct 27, 2006 9:56 am
Reply with quote

thanks !!! i did find the error...my alternate key length was declared wrongly
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top