Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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 -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

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

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

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

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

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

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

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

New 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: 115
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: 10
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
No new posts COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us