Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How do I write a User-defined class

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: New User Defined Class in a program
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

Site Director


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

PostPosted: Fri Feb 13, 2009 9:53 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Fri Feb 13, 2009 11:10 pm    Post subject:
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

Site Director


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

PostPosted: Sat Feb 14, 2009 1:27 am    Post subject:
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    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Feb 14, 2009 9:51 pm    Post subject: Reply to: How do I write a User-defined class
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

Site Director


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

PostPosted: Sat Feb 14, 2009 10:41 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Mar 03, 2009 8:23 pm    Post subject:
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    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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts User access certification In Mainfram... Virendra Shambharkar All Other Mainframe Topics 4 Tue Oct 03, 2017 12:32 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us