COBOL variable with sign leading separate.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Ashish Mathew
Registered Member
Posts: 50
Joined: Thu Jun 27, 2013 6:17 pm

COBOL variable with sign leading separate.

Post by Ashish Mathew »

Hi all,

Please consider these two declarations:

Code: Select all

01 VARIABLE-1 PIC S9(4) SIGN LEADING SEPARATE. 
01 VARIABLE-2 PIC S9(4). 
What are the bytes taken by them. As I understand that first will take 5 and the later will take 4 but one of colleague argued on it. And I suspect I was wrong. What is the way to explain it?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: COBOL variable with sign leading separate.

Post by nicc »

Have you run a quick test?
Regards
Nic
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: COBOL variable with sign leading separate.

Post by William Collins »

A SEPARATE SIGN is separate from the data, so will require an extra byte of storage.
Fine Manual wrote:If the SEPARATE CHARACTER phrase is specified, then:
v The operational sign is presumed to be the LEADING or TRAILING character
position, whichever is specified, of the elementary numeric data item. This
character position is not a digit position.
v The character S in the PICTURE character string is counted in determining the
size of the data item (in terms of standard data format characters).
v + is the character used for the positive operational sign.
v - is the character used for the negative operational sign.
Ashish Mathew
Registered Member
Posts: 50
Joined: Thu Jun 27, 2013 6:17 pm

Re: COBOL variable with sign leading separate.

Post by Ashish Mathew »

Thanks a lot!
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.”