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

How do I write a User-defined class


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

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Fri Feb 13, 2009 2:07 pm
Reply with quote

Dear all,
How do I write a User-defined class in COBOL?

As in
if a is alphabetic then display 'good name'

but unfortunately,
name generally has a '.' also as in 'Mac. Gillan'

in this case, i would like to code

if a is name-like then display 'good name'

where name-like is a user-defined class which includes '.' and alphabets
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: Fri Feb 13, 2009 9:53 pm
Reply with quote

Hello,

Quote:
How do I write a User-defined class in COBOL?
One way would be to define an 88-level and mention all of the acceptable values for a byte. In the code loop thru the name field comparing the current byte against the 88-level.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Fri Feb 13, 2009 11:10 pm
Reply with quote

A quick forum search turned up Checking for Alphanumeric data
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: Sat Feb 14, 2009 1:27 am
Reply with quote

Hello,

If you use the "class-name" (mentioned in the posted link) or an 88, be aware that you should not code "A" thru "Z". There are values in that range that are not values you would consider acceptable. . .

For capital letters you would use "A" thru "I", "J" thru "R", and "S" thru "Z".

I'll let you research the lower case letters icon_smile.gif
Back to top
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Sat Feb 14, 2009 9:20 pm
Reply with quote

Thanks all icon_biggrin.gif

Please educate me the difference between

"A" thru "Z"
and
"A" thru "I", "J" thru "R", and "S" thru "Z"
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Feb 14, 2009 9:51 pm
Reply with quote

The EDCDIC collating sequence defines upper-case letters in interspersed groups of 9, 9 and 8.

For example, an upper-case "A" is a hex X'C1' and an upper-case "I" is a hex X'C9'.

Continuing, an upper-case "H" is a X'D1' and an upper-case "R" is a X'D9' and so-on and so-on.

If you check for "A" through "Z", then you'll also be including bogus hex-values (IE: X'CA' through X'D0'), which may raise a false positive.

The easiest way to check for capital "A" through "Z", would be to use -

IF ALPHABETIC and NOT = SPACE test clause.

This same collating sequence applies to lower-case letters as well.

Regards,
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: Sat Feb 14, 2009 10:41 pm
Reply with quote

Hello,

Keeping in mind that the "." (period) and possibly some other characters may be valid in the name as well. . .
Back to top
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Tue Mar 03, 2009 1:12 pm
Reply with quote

I am unable to use the method suggested. Please look at the COBOL Program i have written in the following link/photo
Image/link removed. .
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: Tue Mar 03, 2009 8:23 pm
Reply with quote

Hello,

As you probably noticed, the link/image did not come thru as you intended and has been removed.

Please post code using copy/paste and the "Code" tag for readability. You do not need to post the entire program, only the parts that have to do with this question and any errors encountered.
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts PuTTY - "User is not a surrogate... IBM Tools 5
No new posts How to delete a user's alias from the... JCL & VSAM 11
No new posts user exit in IBM Infosphere Optim DB2 8
No new posts Running a Job with the Default User ID JCL & VSAM 2
Search our Forums:

Back to Top