First, and not meaning to come across as nasty, you need to learn IBM COBOL. This is a very basic question.
You need to read about and understand the COBOL compile option TRUNC. http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG31/2.4.53 <quote> *TRUNC(BIN)* The TRUNC(BIN) option applies to all COBOL language that processes USAGE BINARY data. When TRUNC(BIN) is in effect, all binary items (USAGE COMP, COMP-4, or BINARY) are handled as native hardware binary items, that is, as if they were each individually declared USAGE COMP-5: - BINARY receiving fields are truncated only at halfword, fullword, or doubleword boundaries. - BINARY sending fields are handled as halfwords, fullwords, or doublewords when the receiver is numeric; TRUNC(BIN) has no effect when the receiver is not numeric. - The full binary content of fields is significant. - DISPLAY will convert the entire content of binary fields with no truncation. *Recommendations:* TRUNC(BIN) is the recommended option for programs that use binary values set by other products. Other products, such as IMS, DB2, C/C++, FORTRAN, and PL/I, might place values in COBOL binary data items that do not conform to the PICTURE clause of the data items. You can use TRUNC(OPT) with CICS programs as long as your data conforms to the PICTUREclause for your BINARY data items. USAGE COMP-5 has the effect of applying TRUNC(BIN) behavior to individual data items. Therefore, you can avoid the performance overhead of using TRUNC(BIN) for every binary data item by specifying COMP-5 on only some of the binary data items, such as those data items that are passed to non-COBOL programs or other products and subsystems. The use of COMP-5 is not affected by the TRUNC suboption in effect. *Large* *literals* *in* *VALUE* *clauses:* When you use the compileroption TRUNC(BIN), numeric literals specified in VALUE clauses for binary data items (COMP, COMP-4, or BINARY) can generally contain a value 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. </quote> Or you need to change the definition from COMP to COMP-5 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR31/5.3.17.1 <quote> *COMPUTATIONAL-5**or* *COMP-5* *(native* *binary)* These data items are represented in storage as binary data. The data items can contain values 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 nines in the picture for the item (as is the case for USAGE BINARY data). When numeric data is moved or stored into a COMP-5 item, truncation occurs at the binary field size rather than at the COBOL picture size limit. When a COMP-5 item is referenced, the full binary field size is used in the operation. The TRUNC(BIN) compiler option causes all binary data items (USAGE BINARY, COMP, COMP-4) to be handled as if they were declared USAGE COMP-5. </quote> On Thu, Jul 18, 2013 at 6:52 AM, Ron Thomas <[email protected]> wrote: > Hello. > > We have a field defined S9(04) COMP , the value that is getting populated > to this field from programs is defined as 9(04) so that works fine > > Now we want the data of length 5 bytes to be moved 28281, but less than > 32781 which is maximum that s9(04) comp holds. Kindly let me know do we > need to change the defintion of S9(04) COMP. > > > Thanks, > Ron T > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > -- This is a test of the Emergency Broadcast System. If this had been an actual emergency, do you really think we'd stick around to tell you? Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
