# How to convert mixed data to all uppercase letters using Easytrieve?

Document ID : KB000050388
Show Technical Document Details

Description:

There is no single Easytrieve command to do this functionality. But below is an example of how to code an Easytrieve program to accomplish this.

Solution:

```  DEFINE FROM-FIELD         W 40 A VALUE 'GOHN          +
abcdefghijklmnopqrstuvwxyz'
DEFINE FROM-FIELD-BYTE   FROM-FIELD    1  A  OCCURS 40
DEFINE FROM-SUB           W    2  N
*  THE TO-FIELD ARRAY USES INDEXING
DEFINE TO-FIELD             W   40  A
DEFINE TO-FIELD-BYTE  TO-FIELD   1  A  OCCURS 40 INDEX TO-INDEX
DEFINE BINARY-LETTER  TO-FIELD   1  B  OCCURS 40 INDEX TO-INDEX
DEFINE FIND-FIELD  W  1  A  VALUE 'G'
DEFINE CHANGE-TO   W  1  A  VALUE 'J'
*
JOB INPUT NULL
PERFORM UP-CASE
PERFORM DISPLAY-RESULTS
STOP
*
UP-CASE. PROC
MOVE ' ' TO TO-FIELD FILL ' '
FROM-SUB = 1
TO-INDEX = 0
* LOOK FOR THE LETTER 'G' AND CHANGE IT TO THE LETTER 'J'
DO UNTIL FROM-SUB GT 40
IF FROM-FIELD-BYTE (FROM-SUB) = FIND-FIELD
TO-FIELD-BYTE (FROM-SUB) = CHANGE-TO
ELSE
TO-FIELD-BYTE = FROM-FIELD-BYTE (FROM-SUB)
END-IF
* NOW CONVERT LOWERCASE LETTERS TO UPPERCASE LETTERS
IF BINARY-LETTER EQ 97  THRU 123
BINARY-LETTER = BINARY-LETTER + 64
END-IF
TO-INDEX = TO-INDEX + 1
FROM-SUB = FROM-SUB + 1
END-DO
END-PROC
DISPLAY-RESULTS. PROC
* DISPLAY THE BEFORE AND AFTER RESULTS
DISPLAY 'RESULTS:'
DISPLAY ' '
DISPLAY '**********************************************************'
DISPLAY '**********************************************************'
DISPLAY 'FROM-FIELD = '  FROM-FIELD
DISPLAY '*************0000000001111111111222222222233333333334*****'
DISPLAY '
1234567890123456789012345678901234567890*****'
DISPLAY '**********************************************************'
END-PROC```

The other suggestion we can offer is to use a character translation table.

There is no special command in CA Easytrieve which will automatically do this.