View previous topic :: View next topic
|
Author |
Message |
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
My Apologies Nic. |
|
Back to top |
|
|
|