View previous topic :: View next topic
|
Author |
Message |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
ashokm
New User
Joined: 28 Feb 2006 Posts: 11 Location: Chennai,India
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Oh Ok. Thanks CICS Guy. |
|
Back to top |
|
|
|