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

Check whether lower or upper case letter are present


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

New User


Joined: 02 Nov 2005
Posts: 12
Location: Delhi

PostPosted: Wed Sep 09, 2009 12:22 am
Reply with quote

Hi,

I am working on a requirement in which I need to check whether lower or upper case letter are present in a string or not?

I need to check a string which is having few lower case, few upper case, few numbers and few special characters. I need to identify each of them and put them into an array. And then dispay the count of each one.

Please help me!
Thanks
garuabhash
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 Sep 09, 2009 12:26 am
Reply with quote

The numbers are USAGE DISPLAY, not USAGE COMP or USAGE COMP-3? Have you clicked on the manuals link at the top of the page, clicked on the COBOL Language Reference manual, and searched for reference modification? If not, start there and let us know if you have any problems after reading.

Is this a homework assignment by some chance?
Back to top
View user's profile Send private message
garuabhash

New User


Joined: 02 Nov 2005
Posts: 12
Location: Delhi

PostPosted: Wed Sep 09, 2009 12:01 pm
Reply with quote

Hi,

This is not a practice assignment.

Here the problem I am facing is, it is receiving the string from a cics screen and when I receive I could see all the string is in upper case.

I am searching for some function in cobol which will tell me that it is upper case letter, lower case letter, etc....

Thanks
garuabhash
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Wed Sep 09, 2009 2:01 pm
Reply with quote

Hi,
Quote:
I receive I could see all the string is in upper case


When once recieved you cannot trace it back for the lower case or uppercase,
check for the CICS program how it is sending the string to your program,
What and why is such requirement that you need to check for the case of the letter?
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 Sep 09, 2009 3:06 pm
Reply with quote

Unless the CICS support person has made provision for lower case data, your screen text will be translated to upper case before your program ever gets to see it. So you don't need a function to check for lower case. And reference modification will let you check for numeric digits.
Back to top
View user's profile Send private message
garuabhash

New User


Joined: 02 Nov 2005
Posts: 12
Location: Delhi

PostPosted: Wed Sep 09, 2009 4:50 pm
Reply with quote

Hi,

Thanks for your reply.

But As per my requirement the cics program should receive the string in the same fashion how it has been entered on the screen. Actually this is a password field on the screen for some online transaction. In which user can enter the lower and upper case letter both. Event heir password can has number and special characters also.

Please tell me the way, how my online program can receive the value in the sane fashion as it entered on the screen.

Thanks
garuabhash
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: Wed Sep 09, 2009 5:02 pm
Reply with quote

Click on the following link -

ibmmainframes.com/viewtopic.php?p=206727&highlight=#206727

Bill
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Wed Sep 09, 2009 5:02 pm
Reply with quote

Hi,

What i understood from your post is that you are not able to get the same input from the screen (MAP) what user has entered.

This topic has been discussed earlier. Go through the following link...it might help you out.

http://www.ibmmainframes.com/post-54827.html
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Sep 09, 2009 5:39 pm
Reply with quote

Robert Sample wrote:
Unless the CICS support person has made provision for lower case data, your screen text will be translated to upper case before your program ever gets to see it.


As Robert and Bill tried to explain...it's a question of the definition of the transaction...ask your systemers.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Sep 09, 2009 8:12 pm
Reply with quote

You can also do this within your CICS program. You perform the routine
it will allow you to accept the input in both upper and lower case. You
perform the routine a 2nd time at it puts the terminal back in upper case.
as all terminals here are defined upper case.



Code:
005400*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*           
005410*                CHANGE TERMINAL TO MIXED CASE                *           
005420*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*           
005430 8300-CHANGE-CASE-SETTING.                                               
005440                                                                         
005450     EXEC CICS INQUIRE                                                   
005460          TERMINAL (EIBTRMID)                                             
005470          UCTRANST (WS-UCTRANS)                                           
005480          RESP     (WS-CICS-RESPONSE)                                     
005490          END-EXEC                                                       
005500                                                                         
005510     IF WS-UCTRANS = DFHVALUE (UCTRAN)                                   
005520       MOVE DFHVALUE (TRANIDONLY) TO WS-UCTRANS                           
005530     ELSE                                                                 
005540       MOVE DFHVALUE (UCTRAN)     TO WS-UCTRANS                           
005550     END-IF                                                               
005560                                                                         
005570     EXEC CICS SET                                                       
005580          TERMINAL (EIBTRMID)                                             
005590          UCTRANST (WS-UCTRANS)                                           
005600          RESP     (WS-CICS-RESPONSE)                                     
005610          END-EXEC                                                       
005620     .                                                                   
005630/                                                                         
Back to top
View user's profile Send private message
smilingashutosh

New User


Joined: 08 Jun 2006
Posts: 22

PostPosted: Wed Sep 09, 2009 11:35 pm
Reply with quote

Robert,
Agreed with you, even in My case we have a seperate TransID when we need to receive case sensitive sgtring.
Ketan,
There could be n number of cases where you could need that like say you screen is displaying an offer name which is case sensitive data taken from a table then once you receive that data it will be received in upper case and next time upper case data will be updated in the table.
So you need to have possibly seperate transid for the screen program for which you want to store case sensitive data.
Back to top
View user's profile Send private message
garuabhash

New User


Joined: 02 Nov 2005
Posts: 12
Location: Delhi

PostPosted: Wed Sep 09, 2009 11:41 pm
Reply with quote

Hi,

Thanks a lot for your response and help.

Please send me the working storage declarations also for the below variables.

WS-UCTRANS, UCTRAN, TRANIDONLY

Thanks
Abhash
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Sep 10, 2009 12:04 am
Reply with quote

Here is the field for WS-UCTRANS, The others a CICS CVDA values found in the CICS System Programming Reference Manual.

UCTRAN is a value of 450 and TRANIDONLY is a value of 452.


Code:
05 WS-UCTRANS                 PIC 9(08) BINARY VALUE 0.
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: Thu Sep 10, 2009 12:30 am
Reply with quote

Getting back to the original question, you could use reference modification to move each byte of your string to a one-byte field that has some 88 levels defined on it:
Code:
88  LOWER-CASE     VALUE 'a' THRU 'i',
                         'j' THRU 'r',
                         's' THRU 'z'.
88  UPPER-CASE     VALUE 'A' THRU 'I',
                         'J' THRU 'R',
                         'S' THRU 'Z'.
88  NUMBERS-ONLY   VALUE '0' THRU '9'.
This allows you to test each byte individually. You mentioned special characters so you'd want another 88 level for them -- but that's trivial to add.
Back to top
View user's profile Send private message
garuabhash

New User


Joined: 02 Nov 2005
Posts: 12
Location: Delhi

PostPosted: Fri Sep 11, 2009 12:29 pm
Reply with quote

Hi,

Where do I need to add the Logic for 'changing the screen in mixed mode'.
I mean it should be before sending the screen or after receiving the screen.

Thanks
Garuabhash
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Sep 11, 2009 7:12 pm
Reply with quote

I make it one of the first things I do in the program and the last thing I do before returning back to cics.
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts How to check whether who renamed the ... JCL & VSAM 3
No new posts No ++JCLIN, APPLY CHECK job JCL & VSAM 1
Search our Forums:

Back to Top