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
 

 

S322 Abend while acessing a KSDS file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Mon Aug 13, 2012 11:52 am    Post subject: S322 Abend while acessing a KSDS file.
Reply with quote

Hi all,

I'm getting s322 abend while trying to read KSDS record with a primary key value.

PFB my code below.

Code:

VSAMPROG START 0                                                       
BEGIN    SAVE  (14,12)                                                 
         BALR  12,0                                                     
         USING *,12                                                     
         ST    13,SAVE+4                                               
         OPEN  VSAMACB                                                 
LOOP     GET   RPL=RPLLAB                                               
         WTO   'SHIVA'                                                 
         TPUT  AREAADDR,L'AREAADDR                                     
         WTO   TEXT=AREALEN,ROUTCDE=(11)                               
*        B     LOOP                                                     
END      WTO   'END OF FILE'                                           
         CLOSE VSAMACB                                                 
         L     13,SAVE+4                                               
         WTO   'AFTER ALL CLOSE'                                       
         RETURN (14,12),RC=0                                           
         LTORG                                                         
*FILE DEFEINITIONS HERE                                                 
VSAMACB  ACB   MACRF=(KEY,DIR,IN),DDNAME=VSAMJCL,EXLST=EXLSTL           
EXLSTL   EXLST EODAD=END                                               
RPLLAB   RPL   ACB=VSAMACB,AREA=AREAADDR,AREALEN=80,ARG=PKEY,KEYLEN=4, X
               OPTCD=(KEY,MVE,DIR),RECLEN=80                           
*VARIABLE DECLARATIONS HERE                                             
SAVE     DS    18F                                                     
PKEY     DC    CL4'1002'                                               
AREALEN  DC    H'80'       
AREAADDR DS    CL80     
         END   VSAMPROG                                             


the output screenshot is given below.

Code:

                                 
IGD103I SMS ALLOCATED TO DDNAME JOBLIB                               
IGD103I SMS ALLOCATED TO DDNAME VSAMJCL                               
IEF237I JES2 ALLOCATED TO SYSOUT                                     
SHIVA                                                                 
1002GHAGRA         10000197                                           
END OF FILE                                                           
AFTER ALL CLOSE                                                       
SHIVA                                                                 
1002GHAGRA         10000197                                           
END OF FILE                                                           
AFTER ALL CLOSE                                                       
SHIVA                                                                 
1002GHAGRA         10000197                                           
END OF FILE                                                           
AFTER ALL CLOSE                                                       
SHIVA                                                                 
1002GHAGRA         10000197                                           
END OF FILE                                                           
AFTER ALL CLOSE                                                       
SHIVA                                                                 
1002GHAGRA         10000197                                           
END OF FILE                                                           
AFTER ALL CLOSE                                                       
SHIVA                                                                 


The same record with primary key value=1002 is getting displayed all the time.
Can somebody help me in identifying the mistake i made.
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Aug 13, 2012 12:31 pm    Post subject:
Reply with quote

You haven't changed the key value in PKEY, so you keep reading the same record.

Garry.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 12:47 pm    Post subject:
Reply with quote

Garry Carroll wrote:
You haven't changed the key value in PKEY, so you keep reading the same record.

Garry.


What the TS shows is that the loop is commented. My guess is that before
he showed his code the loop was after the WTO for EOF.
Beside that R13 is not pointing to his save area, but still pointing to the caller's SA.
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Mon Aug 13, 2012 12:50 pm    Post subject:
Reply with quote

Hi Gary,

i'll be reading the same record again and again if i write GET operation in LOOP area. But here i i have commented the B LOOP line. so GET operation has to be executed only once!!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Aug 13, 2012 1:21 pm    Post subject: Reply to: S322 Abend while acessing a KSDS file.
Reply with quote

If you were running the version with the loop commented out, you'd not get an S322.

You got an S322, so, you are running one that still has the loop in, like Garry said.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 1:57 pm    Post subject:
Reply with quote

This program (if you can call it that) is using the SA of its caller, instead of its own SA. That will lead to unexpected results.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Aug 13, 2012 2:14 pm    Post subject: Reply to: S322 Abend while acessing a KSDS file.
Reply with quote

Sorry Peter. Missed your first post.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 2:28 pm    Post subject: Re: Reply to: S322 Abend while acessing a KSDS file.
Reply with quote

Bill Woodger wrote:
Sorry Peter. Missed your first post.


No problem Bill. Im still in a forgiving mood. icon_rolleyes.gif
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Mon Aug 13, 2012 2:39 pm    Post subject:
Reply with quote

My Mistake, i dint write LA 13,SAVE instruction before OPEN Macro.

Now its working, thanks Peter icon_smile.gif

But why is this infinite loop GET operations occuring when i avoided LA 13,SAVE instruction?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 2:52 pm    Post subject:
Reply with quote

Because SA chaining is not properly set up, registers will contain invalid pointers and/or return adresses.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Aug 13, 2012 4:00 pm    Post subject: Reply to: S322 Abend while acessing a KSDS file.
Reply with quote

Step through your program being called (pencil and old listing paper is OK), doing its stuff and returning to the calling program, and then see where the calling program is going to "return" to :-) and then see what will happen next...
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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