Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1271827
  • 博文数量: 287
  • 博客积分: 11000
  • 博客等级: 上将
  • 技术积分: 3833
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-16 08:43
文章分类
文章存档

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2010-06-21 09:14:10

QSYRAUTU - Retrieve authorized users
 
     **
     **  Program . . : EXA512
     **  Description : Retrieve authorized users (QSYRAUTU) API example
     **  Author  . . : Carsten Flensburg
     **
     **
     **  Compile and setup instructions:
     **    CrtRpgMod   Module( EXA512 )
     **                DbgView( *LIST )
     **
     **    CrtPgm      Pgm( EXA512 )
     **                Module( EXA512 )
     **                ActGrp( *NEW )
     **
     **
     **-- Control specification:  --------------------------------------------**
     H Option( *SrcStmt )
     **-- System information:
     D PgmSts         SDs                  Qualified
     D  PgmNam           *Proc
     **-- API error data structure:
     D ERRC0100        Ds                  Qualified
     D  BytPrv                       10i 0 Inz( %Size( ERRC0100 ))
     D  BytAvl                       10i 0
     D  MsgId                         7a
     D                                1a
     D  MsgDta                      128a
     **-- Global variables:
     D Idx             s             10i 0
     D BytAlc          s             10i 0
     D RcvVar          s          65535a   Based( pRcvVar )
     **-- Global constants:
     D PRF_NAM_GT      c                   '0'
     D PRF_NAM_GE      c                   '1'
     **-- Retrieve API parameters:

     D RtvApi          Ds                  Qualified  Inz
     D  GrpNam                       10a
     D  SltCri                       10a
     **-- List information:
     D RtnRcdFbi       Ds                  Qualified  Inz
     D  BytRtn                       10i 0
     D  BytAvl                       10i 0
     D  NbrPrf                       10i 0
     D  EntLen                       10i 0
     **-- User information:
     D AUTU0100        Ds                  Qualified  Based( pAUTU0100 )
     D  UsrPrf                       10a
     D  UsrGrpI                       1a
     D  GrpMbrI                       1a
     **-- Retrieve authorized users:
     D RtvAutUsr       Pr                  ExtPgm( 'QSYRAUTU' )
     D  RcvVar                    65535a          Options( *VarSize )
     D  RcvVarLen                    10i 0 Const
     D  RtnRcdFbi                    16a
     D  FmtNam                        8a   Const
     D  SltCri                       10a   Const
     D  StrPrf                       10a   Const
     D  StrPrfOpt                     1a   Const
     D  GrpNam                       10a   Const
     D  Error                      1024a          Options( *VarSize )
     D  EndPrf                       10a   Const  Options( *NoPass )

     **-- Entry parameters:
     D EXA512          Pr
     **
     D EXA512          Pi

      /Free

        RtvApi.SltCri = '*MEMBER';
        // RtvApi.GrpNam = 'Insert Group Profile'
        RtvApi.GrpNam = 'NOVAGRPIT';

        BytAlc = 4096;
        pRcvVar = %Alloc( BytAlc );

        DoU  RtnRcdFbi.BytAvl <= BytAlc;

          If  RtnRcdFbi.BytAvl > BytAlc;
            BytAlc = RtnRcdFbi.BytAvl;
            pRcvVar = %ReAlloc( pRcvVar: BytAlc );
          EndIf;

          RtvAutUsr( RcvVar
                   : BytAlc
                   : RtnRcdFbi
                   : 'AUTU0100'
                   : RtvApi.SltCri
                   : '*FIRST'
                   : PRF_NAM_GE
                   : RtvApi.GrpNam
                   : ERRC0100
                   );

          If  ERRC0100.BytAvl > *Zero;
            Leave;
          EndIf;
        EndDo;

        If  ERRC0100.BytAvl = *Zero;

          ExSr  GetPrfInf;
        EndIf;

        *InLr = *On;
        Return;


        BegSr  GetPrfInf;

          pAUTU0100 = pRcvVar;

          For  Idx = 1  to  RtnRcdFbi.NbrPrf;

            // Structure AUTU0100 now contains member user profile information...

            If  Idx < RtnRcdFbi.NbrPrf;
              pAUTU0100 += RtnRcdFbi.EntLen;
            EndIf;
          EndFor;

        EndSr;

      /End-Free

Thanks to Carsten Flensburg
阅读(881) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~