View previous topic :: View next topic
|
Author |
Message |
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
how can an invalid numeric be equals to COMP-3 zeroes. |
I told you before, if you use PIC 9 DISPLAY, COBOL treats you like an idiot and will allow just about anything to happen. That is why you need to qualify any computation or compare with a numeric display field with a preceding IS NUMERIC. Now, had the array been composed of decimal definitions (COMP-3) then you would not have any problems.
until you combine the compare with the IS NUMERIC, you do not have invalid numerics.
RTFM!!!!! |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Hi Scherrer,
PAYEE-ID-NO is a comp-3 field, But in my shop when I display comp-3 field in spool it will be displayed in a readable format.
I am using IOF not SDSF.
Now what I understand is because COBOL treated me as an idiot it went it's on way and gave an undesirable and unpredictable result. Great
Thanks,
Abin. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
Now what I understand is because COBOL treated me as an idiot it went it's on way and gave an undesirable and unpredictable result. Great
|
abin,
The behavior of the machine is predictable. You just have to read the manuals (or in this case, learn from experience). PIC 9 DISPLAY is well documented. Unless you qualify with IS NUMERIC, PIC 9 DISPLAY fields will do what ever you tell them to, regardless of their content, because they are not bound by the rules governing truly numeric definitions.
you are feeling foolish because you made an assumption, don't continue making assumptions. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Abin,
If you have the time and the inclination, change the value in the array to ALL x'00's (getting rid of the x'F0' at the end). Your results will not be the same. Again, if you want to see more of exactly what happened, take a look at the assembler code that was generated to do the compare.
Quote: |
PAYEE-ID-NO is a comp-3 field |
Only by definition - not by content. A comp-3 field must contain
where the d's are digits that must be zero thru nine and the s must be a valid sign.
As DBZ points out, there is a wealth of material in the manuals (which are avaliable via the "Manuals" link at the top of the web page). |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Hi,
Sorry for being late to reply. I am stuck in another important work. I'll do as you suggetsted and let you know of the results.
Thanks for all the support.
Abin. |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
Hi,
if we initialized the numeric values, the data-item contains ZEROs. if that may be a Numeric,COMP,COMP-1,COMP-2,COMP-3.
the data internally process in a binary format.
Ex: PIC 9(10) is decimal. if we want to process this, first it will convert from decimal to binary(internally). it takes time to convert, to avoid this we use COMP. Comp internally stores in a binary format, that's why we cann't display this values directly in the console.
If we declare the data-items in numeric. there is no way to store the ???
the stored values in numeric are NUMERIC (0-9), HIGH-VALUES, LOW-VALUES. |
|
Back to top |
|
|
Saroj Tripathy
New User
Joined: 05 Mar 2007 Posts: 23 Location: India
|
|
|
|
Hi while going thru the mails I found abin mentioning the below
Quote: |
The first entry in the table has some undefined value LOW-VALUE or HIGH-VALUE. Whatever, it is a value that should not be there in a decimal field. My doubt how is an invalid decimal equals to COMP-3 zeroes. Please clarrify whether this is possible or not.
|
Now can it be that LOW-VALUE is same as zeroes and hence the match ??? |
|
Back to top |
|
|
|