- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: cobol truncate
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
- 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
- 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
- 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
- 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