View previous topic :: View next topic |
Author |
Message |
dhruv Beginner
Joined: 01 Jun 2004 Posts: 10 Topics: 1
|
Posted: Thu Jul 22, 2004 4:12 am Post subject: Conversion |
|
|
I am a little confused with the following scenario
VAR1 : Defined as pic 9(3) Contains low-values (x'000000')
VAR2 : Defined as pic 9(3) contains 0 (x'F0F0F0).
IF VAR1 = ZEROES
( This statement is evaluated as false)
If Var1 = Var2
(This satement is evaluated as true)
Can someone tell me what I am missing here ?
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Jul 22, 2004 4:30 am Post subject: |
|
|
dhruv,
how did you populate Low-values to var-1? I don' t think you can have low-values for a numeric integer.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dhruv Beginner
Joined: 01 Jun 2004 Posts: 10 Topics: 1
|
Posted: Thu Jul 22, 2004 4:33 am Post subject: |
|
|
Assigned low-values through group level move
Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Jul 22, 2004 4:39 am Post subject: |
|
|
dhruv,
Please show me your defnition and move statement. I expect a S0C7 abend.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dhruv Beginner
Joined: 01 Jun 2004 Posts: 10 Topics: 1
|
Posted: Thu Jul 22, 2004 4:54 am Post subject: |
|
|
There is no SOC7 abend. I am a little surprised that you expect one.
Anyway, what about the following scenario
VAR1 PIC 9(3) .
VAR1_RDF REDEFINES VAR1 PIC X(3).
MOVE LOW-VALUES TO VAR1_RDF
You will not receive a SOC7
In my particular case, its more like this
01 GROUP.
03 FILLER PIC X(1)
...
...
03 VAR1 PIC 9(3).
MOVE LOW_VALUES TO GROUP |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Jul 22, 2004 5:05 am Post subject: |
|
|
dhruv,
I agree that with redefines you will not encounter S0C7 abend. But with a group you will definitely encounter a S0C7 unless there is a redefine.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Thu Jul 22, 2004 5:23 am Post subject: |
|
|
Just going back to the orignal point:
low-values is not regarded as zero in a 9(3) display field (or a packed or floating point field). It is an invalid value. low-values is only regarded as zero in binary field. |
|
Back to top |
|
|
dhruv Beginner
Joined: 01 Jun 2004 Posts: 10 Topics: 1
|
Posted: Thu Jul 22, 2004 6:06 am Post subject: |
|
|
I agree that low-values are binary zeroes.
So If VAR1 = ZEROES (VAR1 = x'000000')
being evluated as false is correct.
But then, why is the statement
IF VAR1 = VAR2 (VAR1 = x'000000' , VAR2 = x'F0F0F0')
being evaluated as true ?
Thanks |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Thu Jul 22, 2004 9:22 am Post subject: |
|
|
Hi dhruv,
If you change your compiler opts to ...,LIST,NOOFF,... and look at the generated Assembler code for your various instructions, you'll have your answers.
If your REAL ques is "Why did IBM decide to make these instructions behave this way?", only they can answer that. They may even be persuaded to change it, but don't count on it.
Regards, Jack. |
|
Back to top |
|
|
dhruv Beginner
Joined: 01 Jun 2004 Posts: 10 Topics: 1
|
Posted: Thu Jul 22, 2004 10:59 am Post subject: |
|
|
Thanks for all your replies.
The reason i had posted this question was I was under the impression that I was missing something basic.
But if thats the way the cobol compiler is implemented, then ofcourse, i am leaving it at this.
Thanks |
|
Back to top |
|
|
|
|