Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

VSAM return code '23'...saying invalid key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
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    Post subject: VSAM return code '23'...saying invalid key
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    Post subject:
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    Post subject: Re: alternate index
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    Post subject: Re: VSAM return code '23'...saying invalid key
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    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts VSAM RLS=NRI while doing IDCAMS sheersh JCL & VSAM 1 Tue Mar 07, 2017 1:55 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us