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: 1845
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 Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts JES2 doesn't honor the priority of th... Aron Lendvai JCL & VSAM 8 Thu Jun 29, 2017 1:41 pm


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