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
 

 

Getting SOC2 abend in assembler program

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

New User


Joined: 24 May 2009
Posts: 41
Location: Hyderabad

PostPosted: Tue May 26, 2009 11:06 am    Post subject: Getting SOC2 abend in assembler program
Reply with quote

Hi all, I am getting SOC2 abend while running following code, it adds two packed decimal no's and write sum into file.

Code:
ASMQSAM  CSECT                         
         STM  14,12,12(13)             
         BALR 12,0                     
         USING *,12                     
         ST   13,SAVE+4                 
         LA   2,SAVE                   
         ST   2,8(0,13)                 
         LR   13,2                     
                                       
         AP   A,B                       
         ED   VAR,A                     

         MVC  BUFFER,VAR               
         OPEN (SYSPRIN1,OUTPUT)         
         LTR  15,15                     
         BNZ  ERROR2                   
         PUT  SYSPRIN1,BUFFER                                           
ERROR2   EQU   *                                                       
         WTO 'ERROR IN OPENING SYSPRINT',ROUTCDE=11                     
         CLOSE SYSPRIN1                                                 
SAVE     DS   18F                                                       
SYSPRIN1 DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRIN1,RECFM=VBA,BLKSIZE=1370, X
               LRECL=137                                               
BUFFER   DS  0CL137                                                     
VAR      DS  CL137                                                     
A        DC  PL2'1'                                                     
B        DC  PL2'2'                                                     
          END                                     

Please hep me. I am new to assembler language.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Tue May 26, 2009 11:10 am    Post subject: Reply to: Getting SOC2 abend in assembler program
Reply with quote

unless You made a mistake in posting Your program...

at first glance after the close there are no executable instructions
Back to top
View user's profile Send private message
kapiltamrakar

New User


Joined: 24 May 2009
Posts: 41
Location: Hyderabad

PostPosted: Tue May 26, 2009 11:29 am    Post subject: Reply to: Getting SOC2 abend in assembler program
Reply with quote

hi enrico,
i am sorry but i am not able to get your point,
please tell me which mistake am i doing??
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Tue May 26, 2009 11:35 am    Post subject: Reply to: Getting SOC2 abend in assembler program
Reply with quote

let' s make a list of oversights

VAR should contain an edit mask

a few branch instructions are missing
( after a succesfull put, You display the open error message )

You move var over itself

after the close sysprin1 there are no executable instructions
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 26, 2009 7:35 pm    Post subject:
Reply with quote

Hello,

Said differently, what do you want to happen after the CLOSE is executed?

If you don't tell the code what to do, it will simply "fall" onto what ever follows the last assembled instruction (the CLOSE). The 18F is surely not what you wanted to "execute" after the CLOSE.

IBM has a phrase that covers doing something like this - The results may be unpredictable".
Back to top
View user's profile Send private message
kapiltamrakar

New User


Joined: 24 May 2009
Posts: 41
Location: Hyderabad

PostPosted: Wed May 27, 2009 12:33 pm    Post subject: Reply to: Getting SOC2 abend in assembler program
Reply with quote

hi dick scherrer,
let me explain this code by my view point,

AP A,B
it will add the A,B which are two different packed decimal no's and store in A,

ED VAR,A
It will convert the format of A from packed decimal to Charecter variable and store in variable var.

MVC BUFFER,VAR
it will move the content of var to buffer variable.

OPEN (SYSPRIN1,OUTPUT)
i am opening the sysprin1 file in output mode for writting purpose.

BNZ ERROR2
if there will be any problem in opening the file, then it will branch to error2 label.

PUT SYSPRIN1,BUFFER
here i m writting sysprin file from buffer variable.

CLOSE SYSPRIN1
here i am closing this file.


so basically i dont want to perfrom any operation after closing of the file.

if i m missing any thing or doing any conceptual mistake , please correct me.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed May 27, 2009 12:38 pm    Post subject: Reply to: Getting SOC2 abend in assembler program
Reply with quote

in high level languages RETURN,EXIT,... might be omitted and the compiler might provide the proper termination code

using assembler You must take care of it Yourself

agan read my comments, You got a few things wrong

read the POP for the ED instruction
the assembler manual for the meaning of "... DS 0..."

for VB dataset the format of the I/O area should be:
two bytes containing the record length
two bytes x'0000'
the data

use a dcb for a FB or change Your ioarea

I disregarded the S0C2 because there were too many things wrong
did You look at the manual for the meaning of s0c2 abend ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed May 27, 2009 5:00 pm    Post subject:
Reply with quote

Quote:
ED VAR,A
It will convert the format of A from packed decimal to Charecter variable and store in variable var.
Not without an edit mask, it won't.
Quote:
MVC BUFFER,VAR
it will move the content of var to buffer variable.
It's already there -- this is a totally useless instruction; check the assembler output for the offsets of BUFFER and VAR -- you will notice they are exactly the same.
Quote:
so basically i dont want to perfrom any operation after closing of the file.

if i m missing any thing or doing any conceptual mistake , please correct me.
YOU dont' want to do anything else -- the SYSTEM requires you to exit the program in an approved manner, or the IBM phrase "unpredictable results may occur" becomes applicable. Your abend is one of those unpredictable results since you are not following IBM assembler standards.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 27, 2009 11:34 pm    Post subject:
Reply with quote

Hello,

Quote:
so basically i dont want to perfrom any operation after closing of the file.
Then you need to tell the code to restore the caller's environment (SAVE area) and exit. This is known as the "standard linkage convention" and should be part of every assembler program you write.

You used the STM and created the SAVEarea - from some example?

You need to follow the same example for the code to wind up your process, returning control to whatever invoked your code (might be a program or it might be back to the operating system).

You cannot just let the code wander off to vapor. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed May 27, 2009 11:42 pm    Post subject:
Reply with quote

Quote:
You cannot just let the code wander off to vapor. . .
Unless, of course, you want to get an ABEND such as S0C2 or something else ("unpredictable results may occur"). It's still a terrible, horrible programming practice that will, sooner or later, cause serious problems.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Thu May 28, 2009 4:50 pm    Post subject:
Reply with quote

Hi !

Just something beside all the other errors at first sight:

ED VAR,A
MVC BUFFER,VAR
PUT SYSPRIN1,BUFFER

BUFFER DS 0CL137
VAR DS CL137

SYSPRIN1 DCB RECFM=VBA

VBA = Variable-Blocked-Asa

So the record must beginn with record-length and asa-printer-sign

And btw the WTO will allways occur.
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 IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Dump analysis of an assembler module monica1 PL/I & Assembler 4 Tue May 09, 2017 10:05 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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