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

Data overflow in Assebler routine.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nandakumar
Warnings : 2

New User


Joined: 05 May 2005
Posts: 50

PostPosted: Mon Jul 13, 2009 12:39 pm
Reply with quote

Hi Friends.

I am analyzing a job failure related to assembler routine.
The assembler routine abends due data over flow with registers.

The concerned code is given below for your kind reference.

Code:
           AP    0(0,R2),0(0,R3)   ---> here overflow of data occurs
           BO    DUMP           
END        EQU   *               
           L     R13,SAVEREGS+4 
           RETURN (14,12),RC=0   
DUMP       DS    0H             
           ABEND 0069,DUMP       ----> here it fails wit user- bend

Please suggest me solution to overcome this problem.
Thanks,
Nandakumar
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 13, 2009 1:03 pm
Reply with quote

Quote:
abends due data over flow with registers.

registers have nothing to do with the abend
the AP instruction is a SS ( storage to storage ) operation
and the registers are used as standard components of a base+displacement addressing scheme

Code:
AP 0(0,R2),0(0,R3)


I suspect You are hiding something,
usually it does not make any sense to add two one byte packed numbers
statistically You will get an overflow in the....
45% of the cases for positive only operands
24.9% of the cases for mixed sign operands

so it would be fair to describe better the issue and the environment
Back to top
View user's profile Send private message
nandakumar
Warnings : 2

New User


Joined: 05 May 2005
Posts: 50

PostPosted: Mon Jul 13, 2009 2:36 pm
Reply with quote

Hi enrico ,

The below given is the concerned assembler code and while executing the code the job failes with U0069 abend , it is conded in the routine itself.

I want to know why the assembler routine failing.

************************************************************

TITLE 'NRADAR1 - ADDS ELEMENTS OF ONE DIMENSIONALARRAYS'
NRADAR1 START 0
SAVE (14,12)
BALR R12,0
USING *,R12
ST R13,SAVEREGS+4
LA R13,SAVEREGS
LM R2,R6,0(R1)
ICM R2,8,=X'00' CLEAR HIGH ORDER BYTE OF
ICM R3,8,=X'00' EACH TABLE ADDRESS REGISTER
L R4,0(0,R4)
L R6,0(0,R6)
*
* PARAMETER REGISTERS
*
* R2 - ADDRESS OF ARRAY TO WHICH VALUES ARE TO BE ADDED
* R3 - ADDRESS OF ARRAY FROM WHICH VALUES ARE TO BE ADDED
* R4 - NUMBER OF FIRST ELEMENT TO BE ADDED
* R5 - ADDRESS OF NUMBER OF ELEMENTS TO BE ADDED
*
* WORK REGISTERS
*
*
* R7 - LIMITING INDEX VALUE
* R8 - LENGTH CODE MODIFIER
* R10- MULTIPLY REGISTER
* R11- MULTIPLY REGISTER
EJECT
LR R11,R4 ) FIRST ELEMENT NUMBER
A R11,0(0,R5) ) + NUMBER OF ELEMENTS
S R11,=F'2' ) - 2
MR R10,R6 ) X LENGTH
LR R7,R11 ) = LIMITING INDEX VALUE
AR R7,R3
S R4,=F'1'
MR R4,R6 STARTING INDEX VALUE
LR R8,R6
S R8,=F'1' LENGTH CODE MOD.1 ACTUAL LENG
CVD R8,DECIMAL SET LENGTH CODE
MP DECIMAL,=P'17' MODIFIER FOR AP INSTRUCTION
CVB R8,DECIMAL (2 LENGTHS)
AR R2,R4 SET INITIAL ELEMENT ADDRESS
AR R3,R4 SET INITIAL ELEMENT ADDRESS
ADDARRAY EQU *
EX R8,ADD EXECUTE ADD, SUPPLYING LENGTH
BO DUMP DUMP ON OVERFLOW
AR R2,R6 INCREMENT
BXLE R3,R6,ADDARRAY
B END
ADD EQU *
AP 0(0,R2),0(0,R3)
BO DUMP
END EQU *
L R13,SAVEREGS+4
RETURN (14,12),RC=0
DUMP DS 0H
ABEND 0069,DUMP
*
SAVEREGS DS 9D
DS 0D
DECIMAL DS PL8
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
END

Thanks,
Nanda
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 13, 2009 3:19 pm
Reply with quote

You should be able to see it Yourself in the dump by looking at the content of
registers 2,3,8

anyway the r8 content is being built in an overly complicated way
here is a better one ( also easier to understand )
Code:
          lr r8,r6  load 1st lenght
          bctr r8,0 subctract one for ex
          sll r8,4 shift left 4 bits
          or r8,r6 fill nd length
          bctr r8,0 subctract one for ex
Back to top
View user's profile Send private message
nandakumar
Warnings : 2

New User


Joined: 05 May 2005
Posts: 50

PostPosted: Mon Jul 13, 2009 3:31 pm
Reply with quote

Hi enrico,

Can you please let me know how should I check the dump ?

This is first time that I am handling the assembler routine .


Thanks,
Nanda
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top