Page 1 of 1

Using s9(03).9(02) in cobol?

Posted: Tue Apr 04, 2017 2:55 pm
by Sushil
Hi,

In COBOL, why there is restriction on using something like s9(03).9(02)? Why the complier dos not accept it? Can someone please advise.

Re: Using s9(03).9(02) in cobol?

Posted: Tue Apr 04, 2017 5:21 pm
by Robert Sample
PIC S9(03).9(02) mixes picture symbols in an invalid way. PIC S means the variable has a sign so the values can be negative or positive, while the decimal point means the picture is a numeric edited picture; with numeric edited pictures if you include a sign it needs to be explicitly occupying a position or more (+, -, CR for example). In the Enterprise COBOL V6.1 Language Reference manual, page 207 has a table listing which PICTURE symbols can be combined with the others.