Skip to main content

Posts

Featured

IBMi (AS400) fans only - How to pass parameters to a Query

  First of all look at  this post  and compile and populate OTORD00F file to use this example. Let's create a query called Q01A : ccm   represents our parameter to pass to the query. Type F3 Now let's write the CL to pass the ccm parameter to the query: Q01ACL CL ****************** Inizio dati *******************************              PGM        PARM(&CCM)                                          DCL        VAR(&CCM) TYPE(*CHAR) LEN(5)                        STRQMQRY   QMQRY(Q01A) OUTPUT(*) QMFORM(*QMQRY) +                           ALWQRYDFN(*YES) SETVAR((CCM &CCM))               ENDPGM                                             ******************** Fine dati ******************************* We save and compile the CL. Now let's try. Type: CALL PGM(Q01ACL) PARM(('103')) I have two records into OTORD00F with  OTCCM0  = ' 103 '. This is the result: Query . . . . .:   VDOTEST1/Q01A             Larghezza .:       123 Modulo  . . . .:   VDOTEST1/Q

Latest Posts

IBMi (AS400) fans only - How to call a C runtime function from RPG program.

IBMi (AS400) fans only - how to read a flat file with sql embedded

IBMi (AS400) fans only - A simple way to create table with Rpg Free & SQL embedded

IBMi (AS400) fans only - How to send a spool file per Email as TXT attachment