View previous topic :: View next topic |
Author |
Message |
Meg Beginner
Joined: 08 Jul 2003 Posts: 44 Topics: 16
|
Posted: Mon Mar 08, 2004 7:38 am Post subject: Signed Variables in Easytrieve |
|
|
Hi All,
Would like to know if the packed number declared in an easytrive program takes sign to be default.
To make it clear, a variable declared in cobol as 9(1) comp-3 will be declared in an easytrieve program as
VAR1 01 01 P
Does VAR1 have a signed bit as default and does it mean VAR1 is equivalent to S9(1) comp-3?
Also, it looks like when we do a move in easytrieve, say,
MOVE VAR1 to VAR2 where VAR1 and VAR2 are packed variables and VAR2 is equal to 1, the HEX value of VAR1 is 1C while when we say,
VAR1 = VAR2 and VAR2 is 1
VAR1 has a hex value of 1F.
Can anyone let me know why this is happening?
Thanks,
Megana |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Mon Mar 08, 2004 8:18 am Post subject: |
|
|
Megana,
If you specify a numeric field with decimal positions (0 to 18 ), it is considered to be a signed (quantitative) field..If you specify a numeric field with no decimal positions, that field is considered to be unsigned (non-quantitative)
An unsigned packed decimal field (U format) is always unsigned. When you manipulate the field, an F sign is supplied.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Meg Beginner
Joined: 08 Jul 2003 Posts: 44 Topics: 16
|
Posted: Wed Mar 10, 2004 12:20 am Post subject: |
|
|
Hi Kolusu,
Quote: | "When you manipulate the field, an F sign is supplied. " |
I am not able to understand what manipulate means here. Also I guess this is only for unsigned packed decimal field (U format) right? If it is so then why does the P format get a F when we do VAR1 = VAR2.
Also VAR1 when declared as VAR1 01 01 P does not have any decimal point right or does it take default as 0?
Thanks,
Megana |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Wed Mar 10, 2004 6:37 am Post subject: |
|
|
Meghana,
Manipulation meant when you do a calculation(addition , subtraction...) . This is different from a Move.
When you say VAR1 = VAR2 the compiler interprets as if you are manipulating the data(addition of var2 with zero) and provides the 'F' sign.
But when you say move var2 to var1 then you are overlaying the contents of var2 onto var1.
Quote: |
Also VAR1 when declared as VAR1 01 01 P does not have any decimal point right or does it take default as 0?
|
There is no decimal point and it does not take 0 as default. The decimal point declaration not only specifies the decimal position but it also specifies the sign.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Meg Beginner
Joined: 08 Jul 2003 Posts: 44 Topics: 16
|
Posted: Wed Mar 10, 2004 7:29 am Post subject: |
|
|
Thanks Kolusu, I got it finally. |
|
Back to top |
|
|
|
|