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

S322 Abend while acessing a KSDS file.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Aug 13, 2012 12:31 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 12:47 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 13, 2012 1:21 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 1:57 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 13, 2012 2:14 pm
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 2:28 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 13, 2012 2:52 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 13, 2012 4:00 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top