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: 685
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: 1722
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 Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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