IBM Support

ILE RPG IV example using QWCRTVCA

Troubleshooting


Problem

This document shows an example of calling QWCRTVCA from ILE RPG IV program. This is the API equivalent to the CL command RTVJOBA

Resolving The Problem

This document shows an example of calling QWCRTVCA from ILE RPG IV. This is the API equivalent to the CL command RTVJOBA.
Caution: This is an example only. IBM accepts no responsibility for its correctness.

The API call returns the user profile that calls the program. 
Example named WCRTVCA2:
**FREE
Ctl-Opt debug;
Dcl-Ds CurAtr;
     AtNbrAtrRtn     Int(10);
     AtAtrLen1       Int(10);
     AtAtrKey1       Int(10);
     AtAtrDtaTyp1    Char(1);
     *n              Char(3);
     AtAtrDtaLen1    Int(10);
     USERPRF         Char(10);
     *n              Char(3);
End-Ds;

Dcl-S CurAtrLen       Int(10)         Inz( %Len( CurAtr ));
Dcl-S FmtNam          Char(8)         Inz( 'RTVC0100' );
Dcl-S KeyFldNbr       Int(10)         Inz( 1 );
Dcl-Ds KeyFlds;
     *n              Int(10)         Inz( 305 );
End-Ds;

Dcl-Ds ApiError;
// When the bytes provided field is set to zero,
// exceptions will be signaled to the calling program.

     AeBytAvl        Int(10)         Inz( 0 );
End-Ds;
// Prototype for QWCRTVCA
Dcl-Pr Pgm_QWCRTVCA ExtPgm('QWCRTVCA');
     CurAtr          LikeDs(CurAtr);
     CurAtrLen       Int(10);
     FmtNam          Char(8);
     KeyFldNbr       Int(10);
     KeyFlds         LikeDS(KeyFlds);
     ApiError        LikeDs(ApiError);
End-Pr;

Pgm_QWCRTVCA(CurAtr : CurAtrLen : FmtNam : KeyFldNbr :
      KeyFlds : ApiError);

snd-msg userprf;
*INLR = '1'; 
The variable USERPRF will contain the profile running the job.
Compile using CRTBNDRPG.
Test the program by calling from command line:
 > call wcrtvca2   
   BIMBRA          

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000hB4rAAE","label":"API"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

606775761

Document Information

Modified date:
21 November 2024

UID

nas8N1011410