ILERPG.com β€” IBM i Β· ILE RPG Β· AS400 Mastery

This lesson is locked

A short preview is available. Purchase once for lifetime access.

Beginner Β· 10:00

Built-In Functions Part 1: String Manipulation

Incoming text is rarely in the shape a program needs. This lesson covers the built-in functions that measure, extract, search, rewrite, and translate it: %LEN, %SUBST, %SCAN, %REPLACE, %XLATE, and the one-sided members of the trim family, %TRIML and %TRIMR.

What you'll be able to do

  1. 1Use %LEN to determine the current length of a string, and to resize a VARCHAR field by assigning directly to %LEN.
  2. 2Extract a substring with %SUBST, and use %SUBST as a modifiable target to overwrite part of a string in place.
  3. 3Locate the position of a substring within a larger string using %SCAN, and use its result β€” including the zero case β€” to drive further logic.
  4. 4Insert or overwrite a portion of a string using %REPLACE, and distinguish its behavior from %SUBST used as a target.
  5. 5Apply %TRIML and %TRIMR to remove leading or trailing characters independently, and use %XLATE to translate characters, such as for case conversion.

Create your account

Takes a few seconds β€” you'll be right back here after.

Sign in

Welcome back β€” you'll be right back here after.

Forgot your password?