MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VSAM 22 error in CICS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management
View previous topic :: View next topic  
Author Message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 8:34 am    Post subject: VSAM 22 error in CICS Reply with quote

Hi,

I have a VSAM file with first 26 bytes as key. I am not getting any error while I do REPRO to insert values to the VSAM file. But when I access the records through CICS screen I'm getting VSAM 22 error. I do a STARTBR and READNEXT to get the records from VSAM. Could anyone help me on this?
Please let me know if you need more details.

Thanks,
George.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Jul 10, 2008 9:46 am    Post subject: Reply with quote

I suspect there's a write/rewrite in your program(s) somewhere.

Code:
An attempt was made to write a record that would create a duplicate key in a relative file; or an attempt was made to write or rewrite a record that would create a duplicate prime record key or a duplicate alternate record key without the DUPLICATES phrase in an indexed file.


From what I can tell, a VSAM file status = '22' is only returned for a write/rewrite.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jul 10, 2008 10:23 am    Post subject: Reply with quote

when do you get the error 22. startbr or readnext?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 10:24 am    Post subject: Reply with quote

I get it in Startbr. I handled 22 error inside program. Now I'm getting it in Readnext also.
Back to top
View user's profile Send private message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 10:42 am    Post subject: Reply with quote

Hi Sharon,
I do not have any write/rewrite in the program. I'm getting it while reading.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Jul 10, 2008 1:05 pm    Post subject: Reply with quote

I should have asked this first. How do you know it's a 22 VSAM return code? Is it possibly EIBRESP=22? EIBRESP=22 is LENGERR, but according to the manual, that's not a condition returned by a STARTBR. Capture the EIBFN to verify which command issued the condition, EIBRSRCE to verify the resource, EIBRESP, and EIBRESP. Also, show us the actual STARTBR and READNEXT you're using. Let us know if the file you're accessing is a KSDS, RRDS, or AIX.
Back to top
View user's profile Send private message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 1:26 pm    Post subject: Reply with quote

Sorry for the confusion. I'm not getting RESP 22 while STARTBR. It is during READNEXT. It is a KSDS file.

Code:
 
       EXEC CICS STARTBR                           
       FILE   ('OPNORDR')                     
       RIDFLD (WS-OPEN-ORDER-KEY)             
       KEYLENGTH (LENGTH OF WS-OPEN-ORDER-KEY)
       GTEQ                                   
       RESP   (WS-RSP-CODE)                   
       NOHANDLE                               
  END-EXEC                   


Code:

  EXEC CICS READNEXT                         
       FILE   ('OPNORDR')                     
       INTO   (WS-OPEN-ORDER-REC)             
       RIDFLD (WS-OPEN-ORDER-KEY)             
       KEYLENGTH (LENGTH OF WS-OPEN-ORDER-KEY)
       RESP   (WS-RSP-CODE)                   
       NOHANDLE                               
  END-EXEC                                   
Back to top
View user's profile Send private message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 1:28 pm    Post subject: Reply with quote

Key is 26 bytes.
Code:

15  WS-OPEN-ORDER-KEY.                             
    20  WS-OPEN-ORDER-STORE                       
                         PIC 9(04)     VALUE ZEROES
    20  WS-OPEN-ORDER-ITEM                         
                         PIC 9(14)     VALUE ZEROES
    20  WS-OPEN-ORDER-AVAILDT                     
                         PIC X(08)     VALUE SPACES


Code:

DELETE (CAOB.OPEN.ORDERS.KSDS) PURGE           -
       CLUSTER                                 
DEFINE CLUSTER                                 -
        (NAME(CAOB.OPEN.ORDERS.KSDS)           -
         KEYS(26  0)                           -
         INDEXED                               -
         RECSZ(80   80)                        -
         FREESPACE (20  10)                    -
         REUSE                                 -
         SPEED                                 -
         SHR(2 3)                              -
         VOLUME(* * * * *))                    -
       DATA                                    -
        (NAME(CAOB.OPEN.ORDERS.KSDS.DATA)      -
         CYL(10 10))                           -
       INDEX                                   -
        (NAME(CAOB.OPEN.ORDERS.KSDS.INDEX)     -
         CYL(1 1))                             
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Jul 10, 2008 2:05 pm    Post subject: Reply with quote

Try to create a variable as PIC S9(04) COMP to hold the key length. Move the length into that variable, and specify that variable in the KEYLENGTH of the READNEXT. I think LENGTH OF returns a full integer and the KEYLENGTH wants a half word binary.
Back to top
View user's profile Send private message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Thu Jul 10, 2008 3:12 pm    Post subject: Reply with quote

I think I got the issues.
The file record layout was given in the program like this
Code:

10  WS-OPEN-ORDER-REC.                                 
    15  WS-OPEN-ORDER-KEY.                             
        20  WS-OPEN-ORDER-STORE                         
                             PIC 9(04)     VALUE ZEROES.
        20  WS-OPEN-ORDER-ITEM                         
                             PIC 9(14)     VALUE ZEROES.
        20  WS-OPEN-ORDER-AVAILDT                       
                             PIC X(08)     VALUE SPACES.
    15  WS-OPEN-ORDER-QTY    PIC 9(06)V9(03)           
                                           VALUE ZEROES.


The file length is 80 bytes and fillers were not given for remaining bytes. After giving filler of 45 bytes, it worked properly.

Thanks Sharon, your LENERR helped me in finding the issue. Smile
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Fri Jul 11, 2008 8:35 am    Post subject: Reply with quote

Good work. I like it when the op finds and fixes the problem on their own. Thanks for the follow-up post with the solution.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group