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
 

 

BINARY VALUE in COBOL

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

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Sep 30, 2013 3:10 pm    Post subject: BINARY VALUE in COBOL
Reply with quote

hey guyz,

pls explain me this declaration

Code:
05 WS-DATE-MAX              PIC 9(05) BINARY VALUE 40.


i couldnt find in reference books..i found it in production but no idea here with my teammates also..

from the flow of code i understand that this particular field is used as counter but clueless about BINARY VALUE 40
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: Mon Sep 30, 2013 3:22 pm    Post subject:
Reply with quote

BINARY is an alias of COMP.

VALUE 40 means the initial value for the variable is 40.

You need to find better reference books -- both of these terms are completely and thoroughly explained in the Enterprise COBOL Language Reference manual, a link to which is found at the top of this page (IBM Manuals).
Back to top
View user's profile Send private message
bvarun.

New User


Joined: 05 Jul 2013
Posts: 34
Location: India

PostPosted: Mon Sep 30, 2013 3:29 pm    Post subject:
Reply with quote

thanks robert
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Sep 30, 2013 11:47 pm    Post subject: Reply to: BINARY VALUE in COBOL
Reply with quote

In additions to BINARY it will also be possible to find COMP-4. All three mean exactly the same thing.

Familiarise yourself with compiler option TRUNC. If the program in question is compiled with TRUNC(BIN) then it is effectively COMP-5 anyway, which is different.

COMP-5 allows full use of all the bits defined for a field, and does binary truncation to field-size. BINARY, COMP and COMP-4 do decimal truncation to actual PICture size.

Your 5-digit field has a maxium value of 99,999 with TRUNC(STD). With TRUNC(BIN) it has a maximum of one shy of four gigs.

With TRUNC(OPT) it is the programmer's responsibility that the maximum value (positive or negative if signed) from the PICture is not exceeded.
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