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
 

 

Checking for Alphanumeric data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Thu Sep 06, 2007 7:02 pm    Post subject: Checking for Alphanumeric data
Reply with quote

My reqt is to check whether the data in the field is alphanumeric or not. I have seen people using the "IS NUMERIC" and "IS ALPHABETIC" clause. Is there any such thing for searching for alphanumeric data?

I had thought of moving that to 9() and check for numeric + moving to A() and check for alphabetic but it wont work as my field is having data as the combination of alphabetic and numerals. say B14

I searched in this forum before posting but couldn't get the details.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 06, 2007 7:15 pm    Post subject:
Reply with quote

Hello,

One school of thought is that everything is alphanumeric.

I suspect that is not your case.

Please clarify your requirement (i.e. define what values are "alphanumeric" to your process).
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Thu Sep 06, 2007 7:20 pm    Post subject: Reply to: Checking for Alphanumeric data
Reply with quote

Some junk values are getting populated in a field. I need to check if the field is populated with alphanumeric data.

The check should pass if the field is populated with say B15 ( this is just an example ) the test shd fail if the field is populated with junk values.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Sep 06, 2007 7:41 pm    Post subject:
Reply with quote

In SPECIAL-NAMES, CLASS class-name 'A' THRU 'Z' '0' thru '9' and
IF data-area IS (NOT) class-name......

CLASS clause
Class condition
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 06, 2007 8:56 pm    Post subject:
Reply with quote

Hello,

Quote:
The check should pass if the field is populated with say B15 ( this is just an example ) the test shd fail if the field is populated with junk values.
This is not a clarification. . . It just restates your original post.

How should a comma in the data be treated? How about a period? Other readable characters on the keyboard?

You need to define "junk".

What CG posted may be exactly what you want. You may have additional requirements. . .
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Thu Sep 06, 2007 10:42 pm    Post subject:
Reply with quote

My 2 cents. Define the field as a working storage group level - if it is not packed, then move what you need to look at into that field. Look at each field in that group as an individual. Flag fields in an array for not numeric. Anything that is NOT 0-9 is NOT NUMERIC.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Sep 07, 2007 11:31 am    Post subject: Reply to: Checking for Alphanumeric data
Reply with quote

Quote:
How should a comma in the data be treated? How about a period? Other readable characters on the keyboard?
You need to define "junk".


Comma,period and all other characters other than numerals and alphabets should be treated as junk.
Back to top
View user's profile Send private message
ashokm

New User


Joined: 28 Feb 2006
Posts: 11
Location: Chennai,India

PostPosted: Fri Sep 07, 2007 1:24 pm    Post subject:
Reply with quote

Hi Aaru,

Like this we can check what ever the char under JUNK

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
CLASS JUNK IS
'A' THRU 'Z'
'a'THRU 'z ‘
','
'+'
'.'
' '.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 WS-ALPHANUMERIC PIC X(10) VALUE 'B14’.
PROCEDURE DIVISION.
IF WS-ALPHANUMERIC IS JUNK
DISPLAY'JUNK'
ELSE
DISPLAY'NOT JUNK' .
STOP RUN.

Thanks & Reagrds
Ashok M
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Sep 07, 2007 4:54 pm    Post subject: Reply to: Checking for Alphanumeric data
Reply with quote

Thanks ashok and others for the reply.

Quote:
Look at each field in that group as an individual. Flag fields in an array for not numeric


This should be the best option.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Sep 07, 2007 5:59 pm    Post subject: Re: Reply to: Checking for Alphanumeric data
Reply with quote

Aaru wrote:
Quote:
Look at each field in that group as an individual. Flag fields in an array for not numeric
This should be the best option.
Actually that is the most labor intensive and least simple way....Your requirement is exactly what the CLASS test was designed for....
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Sep 07, 2007 6:05 pm    Post subject: Reply to: Checking for Alphanumeric data
Reply with quote

Oh Ok. Thanks CICS Guy.
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


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