Question & Answer
Question
How to convert a value from lower case to upper case in a map
Cause
Answer
User exit example
object ob;
ob = new("java.lang.String",#string_Field);
if #String_Field != ""
then
#string_Field = ob.toUpperCase();
Note that the Java String function toLowerCase() could be used if lowercase text is desired.
The uppercase data can then be mapped to the destination using a link.
If the text to be converted occurs at the end of a record, make certain that the record ends with the segment terminator that has been defined for the data.
Extended rule examples
User exit example
object ob;
ob = new("java.lang.String",#string_Field);
if #String_Field != ""
then
#string_Field = ob.toUpperCase();
Note that the Java String function toLowerCase() could be used if lowercase text is desired.
The uppercase data can then be mapped to the destination using a link.
If the text to be converted occurs at the end of a record, make certain that the record ends with the segment terminator that has been defined for the data.
Extended rule examples
Example 1:
string[26] lowercase; // Holders for String Values
string[26] uppercase;
string[255] fullholder;
string[1] tempholder;
integer x,y;
x=0;
y=0;
tempholder = "";
fullholder = "";
lowercase = "abcdefghijklmnopqrstuvwxyz";
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
while x < len(#TEXT_FIELD) do
BEGIN
tempholder = mid(#TEXT_FIELD,x,1);
y = strstr(lowercase, tempholder); // Make sure it is lowercase Alpha
if y > - 1 then
BEGIN
tempholder = mid(uppercase,y, 1); // Find Uppercase
END
fullholder = fullholder + tempholder;
x = x + 1;
END
#TEXT_FIELD = fullholder;
Example 2:
string[40] PO_Name;
string[40] PO_Character;
Integer Length;
Integer Current_Position;
PO_Name = "";
PO_Character = "";
Current_Position = 1;
// This will convert any lower case letters to upper case.
Length = Len(#PONUMFIELD);
While Current_Position < Length + 1 Do
Begin
PO_Character = Mid(#PONUMFIELD,Current_Position - 1,1);
If PO_Character = "a" Then PO_Character = "A";
If PO_Character = "b" Then PO_Character = "B";
If PO_Character = "c" Then PO_Character = "C";
If PO_Character = "d" Then PO_Character = "D";
If PO_Character = "e" Then PO_Character = "E";
If PO_Character = "f" Then PO_Character = "F";
If PO_Character = "g" Then PO_Character = "G";
If PO_Character = "h" Then PO_Character = "H";
If PO_Character = "i" Then PO_Character = "I";
If PO_Character = "j" Then PO_Character = "J";
If PO_Character = "k" Then PO_Character = "K";
If PO_Character = "l" Then PO_Character = "L";
If PO_Character = "m" Then PO_Character = "M";
If PO_Character = "n" Then PO_Character = "N";
If PO_Character = "o" Then PO_Character = "O";
If PO_Character = "p" Then PO_Character = "P";
If PO_Character = "q" Then PO_Character = "Q";
If PO_Character = "r" Then PO_Character = "R";
If PO_Character = "s" Then PO_Character = "S";
If PO_Character = "t" Then PO_Character = "T";
If PO_Character = "u" Then PO_Character = "U";
If PO_Character = "v" Then PO_Character = "V";
If PO_Character = "w" Then PO_Character = "W";
If PO_Character = "x" Then PO_Character = "X";
If PO_Character = "y" Then PO_Character = "Y";
If PO_Character = "z" Then PO_Character = "Z";
PO_Name = PO_Name + PO_Character;
Current_Position = Current_Position + 1;
End
$INPUT.#PO_NUMBER = PO_Name;
Extended rule example for Application Integration mapper
Post-processing UNIX 'tr' command
Historical Number
PRI658;SCI84667
Was this topic helpful?
Document Information
Modified date:
04 February 2020
UID
swg21548813