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

Inspect a string for any french characters


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

New User


Joined: 13 Oct 2006
Posts: 7

PostPosted: Wed Apr 01, 2009 12:18 am
Reply with quote

Hi,

I am interested in checking the input string for any of the listed french characters. The french character list is as follows:
âÄàáãåçéêëèíîïìÂÄÀÁÃÅÇÉÊËÈÍÎÏÌôÖòóõûÜùúÿÔÖÒÓÕÛÜÙÚ.
If the i/p string contains any one of these characters I convert the entire string to upper case.
Please advise on the best method to search for french characters in the i/p. I thought using INSPECT like
INSPECT INPUT-STRING TALLYING I FOR ALL "â"
J FOR ALL "Ä"
K FOR ALL "à" ............so on for all the characters in the list. But not sure if they is any better method for doing this. I am looking for something like
IF INPUT-STRING = 'â' OR 'Ä' OR 'à' OR.........etc. Atleast one occurence of any of the french characters is good for me.
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 Apr 01, 2009 12:21 am
Reply with quote

Where is the input string coming from? Does the source have the right code page set?

I'd probably have a one-byte variable with an 88 level defining all the French characters. Use a loop for reference modification to move one byte at a time of your input string to the variable and use the 88 level to test; if you have a true do the upper case and exit the loop.
Back to top
View user's profile Send private message
Green_Star

New User


Joined: 13 Oct 2006
Posts: 7

PostPosted: Wed Apr 01, 2009 1:45 am
Reply with quote

Hi,
The requirement is like this:
Program ABC: For ex:
MOVE OWNER-NAME TO WS-NAME.
CALL 'subroutine XYZ' using WS-NAME.
Subroutine: XYZ
In this subroutine I plan to check WS-NAME for any french characters. If any french characters present then fix it by converting them to upper case else do not touch WS-NAME. I have to use this subroutine in many programs.

Thanks,
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: Wed Apr 01, 2009 1:52 am
Reply with quote

Hello,

Will only the "french" characters be changed to uppercase or the entire name?

You may want to define an array that has the "french" character and the "upper case" character you want to use to replace it.

I do not believe the UPPERCASE function will do what you want with the "french" characters. . .
Back to top
View user's profile Send private message
Green_Star

New User


Joined: 13 Oct 2006
Posts: 7

PostPosted: Wed Apr 01, 2009 2:03 am
Reply with quote

Thanks for you response.
I would change the entire string to uppercase using INSPECT CONVERTING.
My initial thought was as follows:

LINKAGE SECTION.
01 french-conv
05 input-string pic x(50).
05 output-string pic x(50).

procedure division using french-conv.
MOVE input-string to output-string.
INSPECT output-string TALLYING WK-FRECH-CHAR FOR FIRST 'âÄàáãåçéêëèíîïìÂÄÀÁÃÅÇÉÊËÈÍÎÏÌôÖòóõûÜùúÿÔÖÒÓÕÛÜÙÚ'

IF WK-FRENCH-CHAR > ZEROES
INSPECT output-string converting "âÄàáãåçéêëèíîïìÂÄÀÁÃÅÇÉÊËÈÍÎÏÌôÖòóõûÜùúÿÔÖÒÓÕÛÜÙÚabcdefghijklmnopqrstuvwxyz" to "AAAAAACEEEEIIIIAAAAAACEEEEIIIIOOOOOUUUUYOOOOOUUUUABCDEFGHIJKLMNOPQRSTUVWXYZ".

But I guess the INSPECT TALLYING doesn't work here for this situation..
Please advise.
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: Wed Apr 01, 2009 2:08 am
Reply with quote

Hello,

No, but you could set up an 88-level for the french-values and run thru a loop using reference modification (per Robert's suggestion).

When the first french char was detected, you should then be able to use the inspect/convert. There would be no need to search the entire string and count all of the "hits".
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top