RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

QUSROBJD API example in RPG IV to test if an object exists Print E-mail
User Rating: / 2
Written by Chamara Withanachchi   
     **-- Header specifications:  --------------------------------------------**
     H Option( *SrcStmt )
     **-- Global variables:  -------------------------------------------------**
     D ObjNam          s             10a
     D ObjLib          s             10a
     D ObjTyp          s             10a
     **-- Api error data structure:  -----------------------------------------**
     D ApiError        Ds
     D  AeBytPro                     10i 0 Inz( %Size( ApiError ))
     D  AeBytAvl                     10i 0 Inz
     D  AeMsgId                       7a
     D                                1a
     D  AeMsgDta                    128a
     **-- Object description structure OBJD0100:  ----------------------------**
     D RoData          Ds
     D  RoBytRtn                     10i 0
     D  RoBytAvl                     10i 0
     D  RoObjNam                     10a
     D  RoObjLib                     10a
     D  RoObjTypRt                   10a
     D  RoObjLibRt                   10a
     D  RoObjASP                     10i 0
     D  RoObjOwn                     10a
     D  RoObjDmn                      2a
     D  RoObjCrtDts                  13a
     D  RoObjChgDts                  13a
     D  RoExtAtr                     10a
     D  RoTxtDsc                     50a
     D  RoSrcF                       10a
     D  RoSrcLib                     10a
     D  RoSrcMbr                     10a
     **-- Retrieve object description:  --------------------------------------**
     D RtvObjD         Pr                  ExtPgm( 'QUSROBJD' )
     D  RoRcvVar                  32767a         Options( *VarSize )
     D  RoRcvVarLen                  10i 0 Const
     D  RoFmtNam                      8a   Const
     D  RoObjNamQ                    20a   Const
     D  RoObjTyp                     10a   Const
     D  RoError                   32767a         Options( *VarSize )
     **-- Get Web value:  ----------------------------------------------------**
     C                   Eval      ObjNam     =  '???'
     C                   Eval      ObjLib     =  '*LIBL'
     C                   Eval      ObjTyp     =  '*PGM'
     C                   CallP     RtvObjD( RoData
     C                                    : %Size( RoData )
     C                                    : 'OBJD0100'
     C                                    : ObjNam + ObjLib
     C                                    : ObjTyp
     C                                    : ApiError
     C                                    )
     C                   If        AeBytAvl   >  *Zero         And
     C                             AeMsgId    =  'CPF9801'
     **-- Object doesn't exist...
     C                   EndIf
     C                   Return

Originaly By : Carsten Flensburg

User Comments

Please login or register to add comments

<Previous   Next>