IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

NUMERIC check in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ksk

Active User


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

PostPosted: Wed Jun 11, 2008 1:46 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 11, 2008 8:52 pm
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: 355
Location: New York

PostPosted: Thu Jun 12, 2008 6:16 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top