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

related to S0C7 and comp-3....


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shyansh_hercules
Warnings : 2

New User


Joined: 12 Oct 2008
Posts: 4
Location: Pune

PostPosted: Tue Oct 21, 2008 12:48 pm
Reply with quote

Please look at the example below.....

Code:
IDENTIFICATION DIVISION.             
 PROGRAM-ID. PGMSOC.                   
 DATA DIVISION.                       
 WORKING-STORAGE SECTION.             
 01 A.                                 
      02 BA PIC 9(18) COMP-3 VALUE 20.
 01 B PIC 9(2).                       
 PROCEDURE DIVISION.                   
     MOVE 12 TO A.                   
     DISPLAY "A:" A.                   
     DISPLAY "BA:"BA.                 
     MOVE A TO B.                     
     DISPLAY 'B:' B.                   
*    ADD BA TO B.                     
     DISPLAY 'B= ',B.                 
     STOP RUN.                         

I am getting a 0C7 abend because of the add operation.....and also found the reason because the variable BA contains garbage value after MOVE 12 TO A operation.

A:12
BA:1 2404040404040404 // why BA contains garbage.
B:12
B= 12

If I do MOVE 12 TO BA...then it is absolutely fine and also in case of BA being USAGE IS DISPLAY ....no problem....

My question is....
1.after MOVE 12 TO A .... A contains 12 but BA contains garbage why??

2.Please somebody tell me the memory layout when we declare a 01 level variable with its sublevels......as i know whenever we give a name to any variable compiler gives memory to it...if we see
Code:
  01 A.                                                               BLW=00000+000         0CL10
      02 BA PIC 9(18) COMP-3 VALUE 20.    BLW=00000+000,0000000 10P 
What does the above sentence mean...which one of them acquire the actual
bytes ....or A is just given the base address of all its following sublevels.....

TIA.
Rahul.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 21, 2008 4:44 pm
Reply with quote

Quote:
My question is....
1.after MOVE 12 TO A .... A contains 12 but BA contains garbage why??

2.Please somebody tell me the memory layout when we declare a 01 level variable with its sublevels......as i know whenever we give a name to any variable compiler gives memory to it...if we see
01 A. BLW=00000+000 0CL10
02 BA PIC 9(18) COMP-3 VALUE 20. BLW=00000+000,0000000 10P
What does the above sentence mean...which one of them acquire the actual
bytes ....or A is just given the base address of all its following sublevels.....
My question is ... Have you ever had any exposure to the internal representation of COBOL values? If so, you should know the answers already; if not, go to the manuals link at the top of the page, click on it, find the COBOL Language Reference, and read section 5.3 on the various formats of COBOL variables. Once you've done that, if you still have questions then post them.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Oct 21, 2008 9:35 pm
Reply with quote

Hello,

In addition to reading the appropriate material in the cobol documentation, there is something you have just discovered that you should pay special attention to. . .

Just because the compiler processes some statements with no error, that is no guarantee that the compiled code will run successfully - the results may not be the desired results or the process may abend (as is the case with your 0c7).
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Oct 21, 2008 10:57 pm
Reply with quote

Pay particular attention to the definition of "Group Moves".
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 -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top