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

How to check whether a field is ALPHANUMERIC or not in COBOL


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

New User


Joined: 25 Jul 2008
Posts: 17
Location: Mumbai

PostPosted: Wed Dec 10, 2008 8:36 am
Reply with quote

Posted: Wed Dec 10, 2008 8:32 am Post subject: how to test whether the field is ALPHANUMERIC or not ?

--------------------------------------------------------------------------------

Hi,

Can anyone pls tell me how to check whether a field defined as X(10) is ALPHANUMERIC or not in COBOL ?

Suppose this field has some special charecters like dot (.) or any other special charecters that are invalid. . .

Similar to Is Numeric and Alphabetic, do we have an for ALPHANUMERIC ?

Please help me out on this.

Thanks in Advance. icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Dec 10, 2008 9:01 am
Reply with quote

Hello,

Do not double-post the same question in multiple parts of the forum. The duplicate has been deleted.

Every pic x(n) field is alphanumeric. The "dot" is what you see for unprintable characters - they are usually not all the same hex value. . .

You need to decide which characters are "good" and which are not and write your code accordingly. There s nothing automatic.
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 Dec 10, 2008 9:10 am
Reply with quote

You can set up a test for whatever characters you don't want by using reference modification or other COBOL facilities; however, since alphanumeric characters include the entire collating sequence you can't test for ALPHANUMERIC in COBOL directly.
Back to top
View user's profile Send private message
samanthjain

New User


Joined: 25 Jul 2008
Posts: 17
Location: Mumbai

PostPosted: Wed Dec 10, 2008 9:11 am
Reply with quote

What actually i need is. . .

i have a file of 1000s of records and in that file i need to select only those records based on the invalid value in one ALPHANUMERIC field.

This X field is showing '0' whenHEX ON. . .which is invalid in my case. . .

Its just one example. . .i think there might be more of these kinds. . .

all i need to do is to seperate this. . .i just want the fields with spaces or numeric or alphabetic or both. . .

how can i do this ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Dec 10, 2008 9:14 am
Reply with quote

Hello,

The first thing you need to do is formailze the rules. What you have posted is too loose. What about lower-case letters? What about quote or comma or dollar-sign?

Once you define the rules, then you can write code to keep/discard the values however you want.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Dec 10, 2008 9:16 am
Reply with quote

Hello,

What you might consider is to set up one byte in working-storage and create an 88 level with either all of the "good" values or all of the "bad" values. Using reference modification, you could verify whether each byte of the problem record/field was valid or not.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 10, 2008 7:54 pm
Reply with quote

Hi Samanth Jain,

Take a look at the CLASS clause of the SPECIAL-NAMES pgraph in the COBOL Reference Manual. I think that's what you're looking for.

See the top of this page and click on"manuals".
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 3
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top