Page 1 of 1

Variable declaration as S9(11).9(1).

Posted: Fri Nov 21, 2014 4:57 pm
by Sudhakar
Hi,

Is there something wrong to declare a numeric variable as S9(11).9(1) in Cobol? I get compilation error if I try this.

Please help in knowing what is wrong with this?

Re: Variable declaration as S9(11).9(1).

Posted: Fri Nov 21, 2014 6:35 pm
by Robert Sample
Yes, there is something wrong -- the compiler is telling you that you cannot do that.

The period means your data is numeric-edited, NOT numeric. And the S is allowed for numeric data but not numeric-edited PICTURE clauses. You can use +, -, CR, or DB to denote the sign in a numeric-edited PICTURE, but you cannot use the S.