View previous topic :: View next topic
|
Author |
Message |
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Hi,
I have a DATE field in FILE with declaration X(10). While moving va alue into this field, 6 digit date was moved (in YYMMDD format) and after move I have to perform NUMERIC check.
I have given following condition.
IF WS-DATE(1:10) IS NUMERIC.
DATE field has 6 digit value in YYMMDD format like 080611 and 7 to 10 positions have spaces. My question is, if I do NUMERIC check on 10 digits, the total 10 digit value will be considered as NUMERIC or Non-NUMERIC as 7 to 10 digits have spaces?
I checked with both 6 and 10 digits but I was not able to see any difference in the final result. Just I want to confirm on this.
Regards,
KSK |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
take a look in the manual. the numeric class check is only valid on pic 9 display and packed-decimal type fields.
anytime you use reference modification, the field type is automatically x - alphanumeric. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Enterprise COBOL 3.4 Language Reference states that identifier-1 must be
DISPLAY, NATIONAL, COMPUTATIONAL-3, or PACKED-DECIMAL when NUMERIC is specified
DISPLAY fields can be PIC X or PIC 9. Further, per the manual (6.1.6.2):
│ An alphanumeric group item can be used in a class condition
│ where an elementary alphanumeric item can be used, except that
│ the NUMERIC class condition cannot be used if the group contains
│ one or more signed elementary items.
so you can do NUMERIC test on a group as long as none of the elementary items are defined as S9... |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Dick/Robert,
Thanks for your responses. I could do NUMERIC check on alphanumeric item.
But my question is
"As 1 to 6 positions have numeric value and 7 to 10 have spaces, how this 10 digit value would be considered (As NUMERC or Non-NUMERIC)"?
I hope I could explain my question. |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
Hi
Redefines gives error ???
Aji |
|
Back to top |
|
|
Manuneedhi K
Active User
Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
ksk wrote: |
Dick/Robert,
Thanks for your responses. I could do NUMERIC check on alphanumeric item.
But my question is
"As 1 to 6 positions have numeric value and 7 to 10 have spaces, how this 10 digit value would be considered (As NUMERC or Non-NUMERIC)"?
I hope I could explain my question. |
It will be considered as non-numeric. |
|
Back to top |
|
|
Max Payne
New User
Joined: 13 Dec 2007 Posts: 10 Location: Shanghai
|
|
|
|
In your sample, it will be considered as NOT NUMERIC. |
|
Back to top |
|
|
|