Problem solve Get help with specific problems with your technologies, process and projects.

Converting from upper case to lower case in RPG

I have a data file with the name in upper case. I'd like to convert The name to upper case for the first letter and lower case for the rest. What's the fastest solution?

You can try using the following code:


 I              'ABCDEFGHIJKLMNOP-    C         UC
 I              'QRSTUVWXYZ'
 I              'abcdefghijklmnop-    C         LC
 I              'qrstuvwxyz'

  * Move the 1st letter to another field.
  * Move the remaining letters to another field.
  * Example, FIELD1 size is 10
 C                     MOVELFIELD1    FIELD2     1
 C                     MOVE FIELD1    FIELD3     9
  * Change field from upper case to lower case.
 C            UC:LC     XLATEFIELD3    FIELD3
  *Join the 2 new fields
 C                     MOVEL*BLANKS   FIELD1
 C                     MOVELFIELD2    FIELD1
 C                     CAT  FIELD3:0  FIELD1


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries ILE programming