LegacyJ CICS and COBOL technology for the J2EE Enterprise Environment

Products     Services     Support     Sales     News     Partners

  

Academic
Programs

Customer
Information

News &
Information

Technical
Information

White
Papers

About Us

LegacyJ FAQ

COMP Truncation using LegacyJ

I am able to move a five digit number into a PIC S9(4) COMP on the mainframe; is there anything  I should know when migrating using LegacyJ?  I am moving a 5 digit number into a 4 digit field in the following manner:

03 RECORD-LENGTH PIC S9(4) COMP VALUE ZERO .  
01 RECEIVE-AREA PIC X(10220).
 
MOVE LENGTH OF RECEIVE-AREA TO RECORD-LENGTH.

Regarding storing values up to +32767 in 77  NBR      PIC S9(4) COMP.  

There is a TRUNC(BIN) option with the IBM COBOL compiler. The equivalent of that in LegacyJ is the following:

Right-click on project name >  Properties > Compiler Options; then select both TRUNCATE BINARY and COMP AS BINARY.  

These settings would allow fields that are defined as "PIC S9(4) COMP" to store values between -32768 and +32767 inclusive. Otherwise, you can fit only a 4-digit number.

If you prefer not to set on TRUNCATE BINARY and COMP AS BINARY, then you can redefine your numeric field to any one of these:  

77  NBR     COMP-S.
77  NBR     BINARY-SHORT.
77  NBR     SIGNED-SHORT. 

Note that there is no PICTURE clause with these declarations.

PERCobol

Home         About Us         Privacy        Legal        
© Copyright LegacyJ Corp. 2007
All Rights Reserved.

All trademarks are the properties of their respective owners or licensers.