- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: cobol truncate
-
-
Forums
- Products
- Servers and Operating Systems
- Storage
- Software
- Services
- HPE GreenLake
- Company
- Events
- Webinars
- Partner Solutions and Certifications
- Local Language
- China - 简体中文
- Japan - 日本語
- Korea - 한국어
- Taiwan - 繁體中文
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Latin America
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Blog, Poland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Forums
-
Blogs
-
Information
-
English
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-18-2013 05:26 AM
06-18-2013 05:26 AM
cobol truncate
Hi all: ¿ how to move maximum possible value to a binary field ??? for example : move 32767 to ws-var ( where ws-var pic 9(04) comp.)
Thanks a lot.
- Tags:
- COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-18-2013 06:43 AM
06-18-2013 06:43 AM
Re: cobol truncate
'just do it'... it works but it looks bad when using Cobol itself to display.
Officially you should use BINARY-SHORT or PIC 9(4) USAGE COMP-5
according to IBM....
Native binary (COMP-5) items
Data items that you declare as USAGE COMP-5 are represented in storage as binary data. However, unlike USAGE COMP items, they can contain values of magnitude up to the capacity of the native binary representation (2, 4, or 8 bytes) rather than being limited to the value implied by the number of 9s in the PICTURE clause
But VMS COB REF:
" BINARY is a synonym for COMPUTATIONAL and COMP.
On Alpha and I64 systems, except for restrictions on the PICTURE
clause, COMPUTATIONAL-5 and COMPUTATIONAL-X are synonyms for
COMPUTATIONAL and COMP."
BINARY-ALTERNATIVE...
Syntax Rule (Format 1)
6. The PICTURE clause is required for every elementary item except an item
specified by the USAGE IS BINARY-CHAR, BINARY-SHORT,
But in practice it is not supported
( HP COBOL V2.9-1453 on OpenVMS IA64 V8.3-1H1 )
01 a_word USAGE IS BINARY-SHORT. .....................^ %COBOL-F-SYN4, Invalid USAGE clause at line number 8 in file SYS$SYSDEVICE:[HEIN]TMP.COB;11 01 a_word USAGE IS BINARY-SHORT. ...^ %COBOL-E-PICREQ, PICTURE clause required - PIC X or PIC 9 assumed, depending on usage
Here is how you can 'just do it', as per DEBUGGER output...
$ run tmp DBG> go comp_5=2767 a_comp=2767 a_hack=2767 DBG> ex/word comp_5, a_comp, a_hack MY_MAIN_PROGRAM\MY_MAIN_PROGRAM\COMP-5: +32767 MY_MAIN_PROGRAM\MY_MAIN_PROGRAM\A-COMP: +32767 A-HACK of MY_MAIN_PROGRAM\MY_MAIN_PROGRAM\ : +32767 $ type tmp.cob IDENTIFICATION DIVISION. PROGRAM-ID. my-main-program. DATA DIVISION. WORKING-STORAGE SECTION. 01 comp_5 PIC 9(4) USAGE COMP-5. 01 a_comp PIC 9(4) USAGE COMP. * 01 a_word USAGE IS BINARY-SHORT. 01 a_long PIC 9(9) USAGE COMP. 01 REDEFINES a_long. 03 a_hack PIC 9(4). PROCEDURE DIVISION. MY_MAIN SECTION. MAIN. MOVE 32767 TO comp_5. MOVE 32767 TO a_comp. * MOVE 32767 TO a_word. MOVE 32767 TO a_long. DISPLAY " comp_5=", comp_5 WITH CONVERSION, " a_comp=", a_comp WITH CONVERSION, * " a_word=", a_comp WITH CONVERSION, " a_hack=", a_comp WITH CONVERSION. STOP RUN.
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-19-2013 06:45 AM
06-19-2013 06:45 AM
Re: cobol truncate
Thank you very very much !!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-13-2013 06:28 PM
07-13-2013 06:28 PM
Re: cobol truncate
Unless it's VAX in which case unsigned integers are not supported
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2022 Hewlett Packard Enterprise Development LP