IBM Support

Use DATA-GEN to replace markers in a string

General Page

A DATA-GEN generator that can be used in an RPG program to replace several markers in a string with an sample program showing how the generator can be used.

You are in: RPG Cafe > Use DATA-GEN to replace markers in a string

 

An RPG programmer wants to substitute the values of variables ITEM and PRICE into the string template "The price of item %ITEM% is $%PRICE%.". The programmer can use DATA-GEN to handle this.

See the attachment "rpltest.rpgle.txt" for program using the DATA-GEN operator with generator MULTRPL.

See the attachment "multrpl.rpgle.txt" for the source code for program MULTRPL.

  • A program that can be used with DATA-GEN operation code. Compile this as program RPLTEST with CRTBNDRPG, taking the defaults: multrpl.rpgle.txt
  • A test program that uses DATA-GEN, specifying RPLTEST as the generator: rpltest.rpgle.txt

[{"Type":"MASTER","Line of Business":{"code":"LOB73","label":"Power TPS"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"ARM Category":[],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"and future releases;7.3.0;7.4.0;7.5.0;7.6.0"}]

Document Information

Modified date:
29 May 2026

UID

ibm17274506