IBM Support

RPG Cafe, Fall 2022: OPTIONS(*CONVERT) to convert parameters to strings

News


Abstract

RPG enhancement delivered through PTFs in the fall of 2022. Convert parameters to strings with OPTIONS(*CONVERT)

Content

You are in: RPG Cafe > RPG Cafe: Fall 2022: Convert parameters to strings

Short URL: https://ibm.biz/rpgcafe_fall_2022_convert

Fall 2022: Convert parameters to strings

  • OPTIONS(*CONVERT): Convert parameters to strings

Details

Convert parameters to strings

Specify OPTIONS(*CONVERT) for any alphanumeric or UCS-2 parameter passed by CONST or VALUE, and you can pass any type of parameter. Numeric, date, time, and timestamp parameters are first converted to character, and then converted to the type of the prototyped parameter.

           myProc (5);
           myProc (%date());
           myProc ('hello');
           return;

           dcl-proc myProc;
              dcl-pi *n;
                 parm varucs2(1000) const options(*convert);
              end-pi;

              snd-msg 'The parameter is ' + parm;
           end-proc;

The output in the joblog is:

The parameter is 5
The parameter is 2022-10-11
The parameter is hello

For a pointer parameter, OPTIONS(*CONVERT) is similar to OPTIONS(*STRING). With OPTIONS(*CONVERT), the passed parameter is first converted to a character value in the job CCSID, and then a null-terminator is added.

           myProc2 (5);
           myProc2 (%date());
           myProc2 ('hello');
           return;

           dcl-proc myProc2;
              dcl-pi *n;
                 parm pointer const options(*convert);
              end-pi;

              snd-msg 'The parameter is ' + %str(parm);
           end-proc;

The output in the joblog is:

The parameter is 5
The parameter is 2022-10-11
The parameter is hello
.                                                            .
.                                                            .

PTFs for 7.4, and 7.5, available in December 2022

7.4:

  • ILE RPG compiler: 5770WDS SI81749

7.5:

  • ILE RPG compiler: 5770WDS SI81801
  • ILE RPG compiler, TGTRLS(V7R4M0): 5770WDS SI81819

The PTFs are also available with Db2 for i Fix Packs. See Db2 for IBM i 2022 PTF Group Schedule.

RDi support

A later update for RDi will support these enhancements.

Documentation

The 7.3, 7.4, and 7.5 ILE RPG Reference and ILE RPG Programmer's Guide are updated with full information about these enhancements. Start at the "What's new since 7.3", "What's new since 7.4", or "What's new since 7.5" section in the Reference.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"ARM Category":[{"code":"a8m0z0000000C4BAAU","label":"IBM i"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.4.0;and future releases"}]

Document Information

Modified date:
01 December 2022

UID

ibm16827011