Skip to main content

[archive] Possible quirk in numerical values

  • September 15, 2008
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 15 September 2008]

Has anyone come across this quirky little problem??

I am using AcuCobol version 5.2 in this exercise.

The field in my input file is defined as:

03 STD-HSALM02 PIC S9(6).

tHIS FIELD CONTAINS A VALUE OF -1.

The field in my output file is defined as:

03 SD-HSALM02 PIC S9(6) COMP-3.

As I want to replace the contents of SD-HSALM02 with the contents ofSTD-HSALM02, the following statement is used to achieve the replacement:

MOVE STD-HSALM02 TO SD-HSALM02.

I expected to see -1 in both fields following the MOVE. This did not happen.
When I view the program using Debugger, I get the following fidplsyed results:

STD-HSALM02 = -1 This is the value of the input field OK

SD-HSALM02 = =1 This is the "corrupted" value of the output field - not OK - especially as =1 does not match the description of the output field.

Cany anyone enlighten me on this?

Thanks

Geoffrey Hashman

1 reply

[Migrated content. Thread originally posted on 15 September 2008]

Has anyone come across this quirky little problem??

I am using AcuCobol version 5.2 in this exercise.

The field in my input file is defined as:

03 STD-HSALM02 PIC S9(6).

tHIS FIELD CONTAINS A VALUE OF -1.

The field in my output file is defined as:

03 SD-HSALM02 PIC S9(6) COMP-3.

As I want to replace the contents of SD-HSALM02 with the contents ofSTD-HSALM02, the following statement is used to achieve the replacement:

MOVE STD-HSALM02 TO SD-HSALM02.

I expected to see -1 in both fields following the MOVE. This did not happen.
When I view the program using Debugger, I get the following fidplsyed results:

STD-HSALM02 = -1 This is the value of the input field OK

SD-HSALM02 = =1 This is the "corrupted" value of the output field - not OK - especially as =1 does not match the description of the output field.

Cany anyone enlighten me on this?

Thanks

Geoffrey Hashman
works for me ...
WORKING-STORAGE SECTION.
01 STD-HSALM02 PIC S9(6) value -1.
01 SD-HSALM02 PIC S9(6) COMP-3.
PROCEDURE DIVISION.

Main Section.
* move -1 to STD-HSALM02.
MOVE STD-HSALM02 TO SD-HSALM02.
display STD-HSALM02 " " SD-HSALM02
accept omitted.