i wonder WHY the picture of a half-word field is s9(04) instead of s9(05).
if i can store up to 32767 in a 2 byte binary field, its cobol picture should be 9(05).
why it isn't?
Because it would require the COBOL compiler to use clairvoyance to determine if a programmer meant for a field with PIC 9(05) to be cast as a 2-byte binary field intended to hold a maximum value of 32,767, OR meant for it to be cast as a 4-byte binary field intended to hold a maximum value of 99,999. Since the compiler is NOT clairvoyant, it requires that the programmer indicate his/her intent to exceed the number of digits in the PICTURE clause ( up to the max value supported ) by explicitly indicating that intent by either specifying COMP-5 or TRUNC(BIN).
I'd wager that you specified a PIC 9(05) rather than 9(04). 9(04) COMP-5 would not generate a full-word binary field.
i specified a pic s9(05) comp-5.
should i have specified s9(04) comp-5?
i'd like to move 15,123 (for example) to it.
thanks.
Yes, you should have coded PIC S9(04) COMP-5. The PIC S9(04) part causes the compiler to allocate only a halfword to the field, and the COMP-5 usage essentially tells the compiler to ignore the fact that the PICTURE specified only 4-digits, and permit you to specify or store values up to the maximum value that a binary halfword will hold, namely 32,767.
While you don't necessarily need to know how to code Assembler, it would be good to study the Principles of Operation manual, which contains a great deal of information besides just the instruction set.
Hi RonB,
Could you please inform in which manual specifically can I find the "Principles of Operation" section?
Thanks.
All times are GMT - 5 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum