Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
NUMERIC check in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
ksk

Senior Member


Joined: 08 Jun 2006
Posts: 307
Location: Pune, India

PostPosted: Wed Jun 11, 2008 1:46 pm    Post subject: NUMERIC check in COBOL
Reply with quote

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
View user's profile Send private message
References
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 1633
Location: germany

PostPosted: Wed Jun 11, 2008 2:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Senior Member


Joined: 06 Jun 2008
Posts: 936
Location: Atlanta, GA

PostPosted: Wed Jun 11, 2008 8:52 pm    Post subject: Reply to: NUMERIC check in COBOL
Reply with quote

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
View user's profile Send private message
ksk

Senior Member


Joined: 08 Jun 2006
Posts: 307
Location: Pune, India

PostPosted: Thu Jun 12, 2008 6:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Aji

Active User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jun 12, 2008 7:07 pm    Post subject: Reply to: NUMERIC check in COBOL
Reply with quote

Hi

Redefines gives error ???

Aji
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 121
Location: Chennai

PostPosted: Thu Jun 12, 2008 7:18 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Max Payne

New User


Joined: 13 Dec 2007
Posts: 12
Location: Shanghai

PostPosted: Tue Jun 24, 2008 1:56 pm    Post subject:
Reply with quote

In your sample, it will be considered as NOT NUMERIC.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1