External Program Integration on IBM i Servers

Related image

RDMLX programs can now call external programs and procedures on IBM i, including RPG programs and procedures in service programs.

The integration is implemented by two new commands:

Def_Mth_Ex

Defines the program, or procedure and service program to call.

Def_Map_Ex

Defines the mapping in terms of data type, length, decimals, formatting, separators, usage as input, update, or both and a return value.

 

These commands can only be used in RDMLX code based components but not web pages.

There is no inherent limitation within LANSA on the number of parameters to be passed. It is only limited by either the C compiler or what happens at run time.

All RDMLX data types are supported except for LOBs. In other words, fixed length character, signed, decimal (packed), binary, date, time, datetime, integer, float, null terminated string, varchar (integer length followed by the value), boolean & nvarchar (integer length in characters followed by the value) are supported.

Return values from procedures are supported.

This example defines an external method, in this case a call to a program to test that dates are mapped to all the IBM i RPG supported date formats and separators:

/* Call program with miscellaneous Date parameters (Run OK) */

Def_Mth_Ex Name(CallPgmMiscDate) Module(P157373J)

Def_Map_Ex Name(DateISO) For(*INPUT) Type(*DATE) Format(*ISO)

Def_Map_Ex Name(DateJIS) For(*INPUT) Type(*DATE) Format(*JIS)

Def_Map_Ex Name(DateEUR) For(*INPUT) Type(*DATE) Format(*EUR)

Def_Map_Ex Name(DateUSA) For(*INPUT) Type(*DATE) Format(*USA)

Def_Map_Ex Name(DateDMYc) For(*INPUT) Type(*DATE) Format(*DMY) Date_Separator(*COMMA)

Def_Map_Ex Name(DateMDYd) For(*INPUT) Type(*DATE) Format(*MDY) Date_Separator(*DOT)

Def_Map_Ex Name(DateYMDh) For(*INPUT) Type(*DATE) Format(*YMD) Date_Separator(*HYPHEN)

Def_Map_Ex Name(DateJULs) For(*INPUT) Type(*DATE) Format(*JUL) Date_Separator(*SLASH)

Def_Map_Ex Name(DateDMYb) For(*INPUT) Type(*DATE) Format(*DMY) Date_Separator(*BLANK)

 

This method routine executes the call:

/* Call program with miscellaneous Date parameters (Run OK) */

Mthroutine Name(MthCallPgmMiscDate)

Define Field(#DatISO) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatJIS) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatEUR) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatUSA) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatDMYc) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatMDYd) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatYMDh) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatJULs) Type(*DATE) Default(*YYYYMMDD)

Define Field(#DatDMYb) Type(*DATE) Default(*YYYYMMDD)

#COM_OWNER.CallPgmMiscDate( #DatISO #DatJIS #DatEUR #DatUSA #DatDMYc #DatMDYd #DatYMDh #DatJULs #DatDMYb )

Endroutine