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

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Sudhakar
New Member
Posts: 5
Joined: Mon May 19, 2014 10:40 am

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

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1900
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”