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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to check whether a field is ALPHANUMERIC or not in COBOL
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

Site Director


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

PostPosted: Wed Dec 10, 2008 9:01 am    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Wed Dec 10, 2008 9:10 am    Post subject:
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    Post subject: Reply to: How to check whether a field is ALPHANUMERIC or no
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

Site Director


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

PostPosted: Wed Dec 10, 2008 9:14 am    Post subject:
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

Site Director


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

PostPosted: Wed Dec 10, 2008 9:16 am    Post subject:
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    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
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


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