View previous topic :: View next topic
|
Author |
Message |
Sakthi393
New User
Joined: 18 Jun 2008 Posts: 4 Location: India
|
|
|
|
I have 2 comp-3 variables A and B,
A PIC S9(015)V99 COMP-3.
B PIC S9(015)V999 COMP-3.
I have a statement
MOVE A TO B
what happens when I move a
S9(015)V99 COMP-3 to to S9(015)V999 COMP-3
There is no statement to initialise B. Will there be 1 character with junk data vin B? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Read about the MOVE verb in the COBOL Manuals. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
No, the last digit will become a zero -- following the usual rules of arithmetic. From the COBOL Language Reference (manuals link at the top of the page):
Quote: |
5.1.6.6 Alignment rules
The standard alignment rules for positioning data in an elementary item depend on the category of a receiving item (that is, an item into which the data is moved; see "Elementary moves" in topic 6.2.24.1).
Numeric
For such receiving items, the following rules apply:
1. The data is aligned on the assumed decimal point and, if necessary, truncated or padded with zeros. (An assumed decimal point is one that has logical meaning but that does not exist as an actual character in the data.)
2. If an assumed decimal point is not explicitly specified, the receiving item is treated as though an assumed decimal point is specified immediately to the right of the field. The data is then treated according to the preceding rule. |
|
|
Back to top |
|
|
Sakthi393
New User
Joined: 18 Jun 2008 Posts: 4 Location: India
|
|
|
|
Thank you for the reply.... |
|
Back to top |
|
|
|