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
 

 

Strange output with COMP-3 variable. Expecting SOC7 but got

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Fri Feb 17, 2012 10:26 am    Post subject: Strange output with COMP-3 variable. Expecting SOC7 but got
Reply with quote

I found a strange thing in one of our code. Although it seems very basic but I could not understand why it is not giving SOC7:

Code:
05 I-AM-COMP3               PIC S9(4)  COMP-3.             
05 ABCD                     PIC X(3).                     
 
PROCEDURE DIVISION.       
     DISPLAY  I-AM-COMP3                         
*SOC7                                             
     MOVE 'XYZ'                  TO ABCD         
     MOVE ABCD                   TO I-AM-COMP3   
     DISPLAY  'ABCD : '          ABCD             
     DISPLAY  'I-AM-COMP3: '     I-AM-COMP3       
     ADD  2                      TO I-AM-COMP3   
     DISPLAY  'I-AM-COMP3:+2 '     I-AM-COMP3     
*                                             


It compiled and run without any abend. I was expecting a SOC7 since 'XYZ' is getting moved to a packed field. I got following output:

Code:
0000                                       
ABCD : XYZ                 
I-AM-COMP3: 0789           
I-AM-COMP3:+2 0791         
 

This could be because XYZ = hex of E7E8E9 and if we pack XYZ it gives 789E which is a positive number. But should;nt it give SOC7 in COBOL ??
Back to top
View user's profile Send private message

agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Fri Feb 17, 2012 11:15 am    Post subject:
Reply with quote

Please go through below links of similar topics that have been discussed on the forum before.
http://ibmmainframes.com/archive/o_t__t_23275__start_0__index.html
http://www.ibmmainframes.com/viewtopic.php?t=19789

Let us know if you have further questions.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1788
Location: UK

PostPosted: Fri Feb 17, 2012 12:27 pm    Post subject:
Reply with quote

Almost 4 years on the forum and you do not know how to search? And you have not read the other threads on this topic which comes up every month or so with COMPLETE information as to what is going on? If you visit the forum every day and read ALL the new stuff, even if it is not related to what you do, you will learn. I am always learning from the fora
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Fri Feb 17, 2012 1:06 pm    Post subject:
Reply with quote

My Apologies Nic.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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