View previous topic :: View next topic |
Author |
Message |
johngo_za Beginner

Joined: 14 Mar 2008 Posts: 7 Topics: 2 Location: Pretoria, SA
|
Posted: Mon Apr 07, 2008 6:24 am Post subject: SIgn is leading separate |
|
|
Hi all,
Please could you assist me,
I need to calculate the amount of bytes taken by the following fields,
01 NUMBER-1 PIC S9(4) SIGN LEADING SEPARATE.
01 NUMBER-2 PIC S9(4).
I KNOW THAT I ACTUALLY LEARNED THIS WHEN IS DID MY PROGRAMMING COURSE BUT HAD AN ARGUMENT WITH SOMEBODY AT WORK ABOUT IT,
THANKS IN ADVANCE, |
|
Back to top |
|
 |
johngo_za Beginner

Joined: 14 Mar 2008 Posts: 7 Topics: 2 Location: Pretoria, SA
|
Posted: Mon Apr 07, 2008 6:37 am Post subject: |
|
|
I found the following:
=====================================================
The SIGN clause can be specified only for a signed numeric data description entry (that is, one whose PICTURE character-string contains an S) or for a group item that contains at least one such elementary entry. USAGE IS DISPLAY must be specified explicitly or implicitly. If a SIGN clause is specified in either an elementary or group entry subordinate to a group item for which a SIGN clause is specified, the SIGN clause for the subordinate entry takes precedence for the subordinate entry. If you specify the CODE-SET clause in an FD entry, any signed numeric data description entries associated with that file description entry must be described with the SIGN IS SEPARATE clause. The SIGN clause is required only when an explicit description of the properties or position of the operational sign is necessary. When specified, the SIGN clause defines the position and mode of representation of the operational sign for the numeric data description entry to which it applies, or for each signed numeric data description entry subordinate to the group to which it applies. If the SEPARATE CHARACTER phrase is not specified, then: v The operational sign is presumed to be associated with the LEADING or TRAILING digit position, whichever is specified, of the elementary numeric data item. (In this instance, specification of SIGN IS TRAILING is the equivalent of the standard action of the compiler.) v The character S in the PICTURE character string is not counted in determining the size of the item (in terms of standard data format characters). 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
=====================================================
If I am interpreting this correctly then NUMBER-1 will be 5 bytes long and NUMBER-2 will be 4 bytes long.
Am I correct in my interpretation?
Thanks
John |
|
Back to top |
|
 |
jyoung Beginner
Joined: 10 Nov 2005 Posts: 36 Topics: 2 Location: Flint, MI
|
Posted: Mon Apr 07, 2008 7:55 am Post subject: |
|
|
I count them both as 5 bytes long due to the sign. The "Sign leading separate" phrase should not make a difference when determining what number of bytes are used to store the value. |
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon Apr 07, 2008 8:24 am Post subject: |
|
|
Hi iyoung,
I'm afraid you're mistaken:
A DISPLAY NUMERIC field [PIC S9(4).] has an integrated sign and 4 bytes (F0F0F0C1) for a value of +1; the corresponding SIGN IS TRAILING SEPARATE variable generates a separate sign (4E) and a 5 byte value (F0F0F0F14E) for +1. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
jyoung Beginner
Joined: 10 Nov 2005 Posts: 36 Topics: 2 Location: Flint, MI
|
Posted: Tue Apr 08, 2008 7:26 am Post subject: |
|
|
Hi Slade,
Don't be afraid when you are correct. Thank you for correcting my mistake. Must have had a brain fart. I don't know what I was thinking. |
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Tue Apr 08, 2008 12:56 pm Post subject: |
|
|
Hi iyoung,
Thank you for your gracious reply. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
johngo_za Beginner

Joined: 14 Mar 2008 Posts: 7 Topics: 2 Location: Pretoria, SA
|
Posted: Thu Apr 10, 2008 3:48 am Post subject: |
|
|
Thanks to both of you  |
|
Back to top |
|
 |
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Thu Apr 10, 2008 5:50 pm Post subject: |
|
|
The compiler tells you also how long the field is in two ways: in the listing and using the LENGTH OF statement. |
|
Back to top |
|
 |
|
|