Edited Numeric fields in COBOL
Posted on 2003-12-01
i'm quite new to COBOL and i have a bit of a problem. I have the following fields:
01 NUM1 PIC S9(13)V9(2).
01 NUM2 PIC -Z(12)9.99.
01 TXT1 PIC X(15).
01 COMMENT PIC X(257).
NUM1 is populated by some process, and is copied into NUM2.
I am using COMMENT for the primary output, which contains "XXXXXXXXXXXXXX, -0.00"
where XXXXXXXXXXXXXX comes from TXT and -0.00 should come from NUM2 (using the STRING command)
however, if the value in NUM2 is less than 15 characted long, eg. -12.34.....the value in COMMENT becomes:
now, is there some other way to make the output similar to this: