View previous topic :: View next topic
|
Author |
Message |
spainj125
New User
Joined: 25 Jan 2007 Posts: 7 Location: Atlanta, GA
|
|
|
|
Having an issue where we are receiving input data into the system with an accent mark above the vowels (circumflex, umlat, grave, acute, etc) giving letters that look like ( â ä à á ã å ç ). In discussing with a couple of coworkers how to translate these to regular characters, we could not think of anything except (checking if not alphabetic) inspecting each character individually for one of the hex values of these symbols. This would use a string statement and a loop. But this would also require 72 different checks as there are 6 different possibilities (all vowels and 'y').
Was checking to see if anyone new of an easier and less tedious way to do this in COBOL?
Thanks.. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
You could use an INSPECT CONVERTING specifying the FROM characters as LITERALS as well as the TO characters as LITERALS.
This format of INSPECT would generate a single Assembler TR (Translate) instruction and its efficiency would rival that of native Assembler.
INSPECT REPLACING (regardless) as well as INSPECT CONVERTING (using WS fields as opposed to LITERALS), would cause a call (BALR) to a COBOL run time routine.
Regards, |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Quote: |
Was checking to see if anyone new of an easier and less tedious way to do this in COBOL? |
It could be done by inspecting within a loop against a table of translations.
A small assembler sub-routine with a translate instruction could be called, that would be quite quick. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You are discussing with the wrong people,
are You in a multilingual environment,
in this case it would be bad to loose significance in the strings
rather than a quick and dirty translation of apparently wrong
it would be wiser to understand better the application environment
maybe You are outsourcing for a German/French/Spanish customer
and he certainly would not like to lose perfectly legal german/french/spanish chars |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Enrico raises a legitimate issue regarding the replacement of these letters in a given language.
Do you know the hex-values of these characters? Because (for example) a German letter "ä" might be a X'81' (a lower-case "a") in an English collating sequence.
So, I believe you need to compare the other letters (from different languages and collating sequence), with that of an English collating sequence.
You may find that their English counterparts are the same hex-values.
Regards, |
|
Back to top |
|
|
spainj125
New User
Joined: 25 Jan 2007 Posts: 7 Location: Atlanta, GA
|
|
|
|
Thanks for the ideas everyone. This will help me greatly. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I just Googled "Ebcdic Collating Sequence in German" and found a translate table, which indicates that a German "ä" is a X'C0' in their collating sequence, whereas, a X'C0' in the English collating sequence is a left bracket ("{").
Regards, |
|
Back to top |
|
|
|