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
 

 

ZEROS and ZEROES in COBOL.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shobha acharya

New User


Joined: 29 Jul 2010
Posts: 1
Location: Bangalore

PostPosted: Thu Jul 29, 2010 1:53 pm    Post subject: ZEROS and ZEROES in COBOL.
Reply with quote

Could anyone explain the difference between ZEROS and ZEROES in COBOL?
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Jul 29, 2010 2:26 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jul 29, 2010 4:24 pm    Post subject:
Reply with quote

The E?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jul 29, 2010 5:09 pm    Post subject: Reply to: ZEROS and ZEROES in COBOL.
Reply with quote

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
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
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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