Joined: 09 Mar 2011 Posts: 7312 Location: Inside the Matrix
PIC 9(4) COMP can hold a maximum value of 9999 due to "decimal truncation" for COMP/COMP-4/BINARY fields.
PIC 9(4) COMP-5 can hold a maximum value of 64k-1 due to "binary truncation" (truncation to field size) for COMP-5 fields.
All USAGE COMP/COMP-4/BINARY fields can be automatically changed to COMP-5 without further coding by specifying compiler option TRUNC(BIN), but you definitely don't want to do that due to the need to re-test everything.
So, change you definition from COMP to COMP-5 and you should be good-to-go.
Remember decimal vs binary truncation always. If your field-size is limited (you can't make it bigger, because it is someone else's definition) and you need more than the PICture number of digits, make it COMP-5.