View previous topic :: View next topic
|
Author |
Message |
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
unless You made a mistake in posting Your program...
at first glance after the close there are no executable instructions |
|
Back to top |
|
|
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
kapiltamrakar
New User
Joined: 24 May 2009 Posts: 41 Location: Hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
|