Page 1 of 1

COBOL variable with sign leading separate.

Posted: Mon Sep 14, 2015 12:38 pm
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?

Re: COBOL variable with sign leading separate.

Posted: Mon Sep 14, 2015 3:16 pm
by nicc
Have you run a quick test?

Re: COBOL variable with sign leading separate.

Posted: Mon Sep 14, 2015 4:13 pm
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.

Re: COBOL variable with sign leading separate.

Posted: Sat Oct 03, 2015 8:22 pm
by Ashish Mathew
Thanks a lot!