View previous topic :: View next topic
|
Author |
Message |
Green_Star
New User
Joined: 13 Oct 2006 Posts: 7
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Green_Star
New User
Joined: 13 Oct 2006 Posts: 7
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Green_Star
New User
Joined: 13 Oct 2006 Posts: 7
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|