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 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: 2502
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm
No new posts SORT - E15 and E35 using same user ex... Abhi Nature DFSORT/ICETOOL 12 Mon Oct 03, 2016 4:33 pm
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts Getting list of tables defined under ... kishpra DB2 2 Wed Aug 24, 2016 10:36 am


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