View previous topic :: View next topic
|
Author |
Message |
shobha acharya
New User
Joined: 29 Jul 2010 Posts: 1 Location: Bangalore
|
|
|
|
Could anyone explain the difference between ZEROS and ZEROES in COBOL? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
No difference, simply synonyms, as you can see in the fine manual.
Quote: |
Figurative constants are reserved words that name and refer to specific constant values. The reserved words for figurative constants and their meanings are:
ZERO/ZEROS/ZEROES
Represents the numeric value zero (0), or one or more occurrences of the character zero (0), depending on context. |
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The E? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
This also applies to the other figurative constants, such as LOW-VALUE/LOW-VALUES, SPACE/SPACES, HIGH-VALUE/HIGH-VALUES, etc.
Usage of a literal as opposed to its figurative constant can cause unexpected differences. EG:
Code: |
03 WS-FIELD PIC X(256).
MOVE '0' TO WS-FIELD.
MOVE ZERO TO WS-FIELD.
|
In the first MOVE, WS-FIELD's first-byte will contain a '0', followed by 255 spaces, whereas, in the second MOVE, WS-FIELD will contain ALL '0's.
The motto here is to always use the figurative constant associated with the field's data-type and the compiler will take care of the rest.
Bill |
|
Back to top |
|
|
|