IBM Support

Example of RPGLE Calling the QSYRUSRI API

Troubleshooting


Problem

This document contains an example of how to code an ILE RPG program that calls the QSYRUSRI API.

Resolving The Problem

Caution: This is an example only. IBM accepts no responsibility for its correctness.


Following is an example of how to code an ILE RPG program that calls the QSYRUSRI API.
This sample will check if the userid running this program is part of a group profile.

Example named SYSUSR1
**FREE
/COPY QSYSINC/QRPGLESRC,QUSEC
/COPY QSYSINC/QRPGLESRC,QSYRUSRI

Dcl-Pr GetUsrInf ExtPgm('QSYRUSRI');
  RcvVar          Likeds(QSYI0200);
  RcvVarLen       Int(10)         const;
  Format          Char(8)         const;
  UserPrf         Char(10)        const;
  Error           Likeds(QUSEC);
End-Pr;

Dcl-S Msg             Char(40);

  QUSBPRV = 0; // Bytes provided in QUSEC error code parameter
  callp GetUsrInf(QSYI0200:%Size(QSYI0200):'USRI0200':'*CURRENT'
     :QUSEC);
  Msg = 'Group profile is ' + QSYGP01;
  Dsply Msg;

  *InLR = *On;  
                          
Note: To use the copybooks, you will need to install Option 13 of 5770SS1 to get the QSYSINC library.
Compile using CRTBNDRPG   PGM(<yourlib>/SYSUSRI1) SRCFILE(<yourlib>/QRPGLESRC) SRCMBR(SYSUSRI1)
> call sysusri1                 
  DSPLY  Group profile is *NONE
> call bimbra/sysusri1           
  DSPLY  Group profile is QPGMR  

                                

[{"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

353841672

Document Information

Modified date:
14 November 2024

UID

nas8N1015883