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.
Joined: 06 Jun 2008 Posts: 8165 Location: East Dubuque, Illinois, 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.
The requirement is like this:
Program ABC: For ex:
MOVE OWNER-NAME TO WS-NAME.
CALL 'subroutine XYZ' using WS-NAME.
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.
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..