RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

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

Validates a System i Username and Password Print E-mail
User Rating: / 0
PoorBest 

Written by Chamara Withanachchi   
 
 *---------------------------------------------------------------------------------
 *  this api validates a System i username and password: 
 *  Author : Chamara Withanachchi
 *  Date   : 2009/02/25 
 *---------------------------------------------------------------------------------
 DpUser            S             10A 
 DpPassword        S             10A 
 DProfileHandle    S             12A 
 DPassWordLength   S             10i 0 inz(10) 
 DCCSID            S             10i 0 inz(37) 
 DUsecc            S          32000A 
 
 D DSChkUser       PR                  EXTPGM('QSYGETPH') 
 D   User                        10A 
 D   Password                    10A 
 D   ProfileHdlr                 12A 
 D   Usec                     32000A 
 D   PassLen                     10i 0 
 D   passCCSID                   10i 0 
 
 D #rtnCode        S              8b 0 
 
 * 
 DQUSEC            DS 
 *                                             Qus EC 
 D QUSBPRV                 1      4B 0 
 *                                             Bytes Provided 
 D QUSBAVL                 5      8B 0 
 *                                             Bytes Available 
 D QUSEI                   9     15 
 *                                             Exception Id 
 D QUSERVED               16     16 
 *                                             Reserved 
 D ERRC0100               17    274    Varying 
 
 d error           S               n 
 d #Message        S             50A 
 
 *---------------------------------------------------------------------------------
 /TITLE       ...... Entry Parameter List ...... 
 *---------------------------------------------------------------------------------
 C     *Entry        Plist 
 C                   parm                    pUser 
 C                   parm                    pPassword 
 
 *---------------------------------------------------------------------------------
 /TITLE       ...... Main Line ...... 
 *---------------------------------------------------------------------------------
 * 
 C                   Callp     DSChkUser(pUser: 
 C                                       pPassword: 
 C                                       ProfileHandle: 
 C                                       Usecc: 
 C                                       PasswordLength: 
 C                                       CCSID) 
 * 
 C                   eval      QUSEC = Usecc 
 
 C                   If        QUSBAVL > 0 
 C                   Eval      Error = *ON 
 
 C                   Select 
 C                   When      QUSEI = 'CPF22E2' 
 C                   Eval      #Message = 'Password not correct for user ' +
 C                                        'profile ' + %trim(pUser) 
 C                   When      QUSEI = 'CPF22E3' 
 C                   Eval      #Message = 'User profile ' + %trim(pUser) + 
 C                                        ' is disabled.' 
 C                   When      QUSEI = 'CPF22E4' 
 C                   Eval      #Message = 'Password for user profile ' + 
 C                                        %trim(pUser) + ' has expired.' 
 C                   When      QUSEI = 'CPF22E5' 
 C                   Eval      #Message = 'No password associated with ' + 
 C                                        'profile ' + %trim(pUser) 
 C                   When      QUSEI = 'CPF22E6' 
 C                   Eval      #Message = 'Maximum number of profile ' + 
 C                                        'handles have been generated.' 
 C                   When      QUSEI = 'CPF22E9' 
 C                   Eval      #Message = '*USE authority to user profile ' 
 C                                        + %trim(pUser) + 'required.' 
 C                   When      QUSEI = 'CPF2203' 
 C                   Eval      #Message = 'User profile ' + %trim(pUser) + 
 C                                        ' not correct.' 
 C                   When      QUSEI = 'CPF2204' 
 C                   Eval      #Message = 'User profile ' + %trim(pUser) + 
 C                                        ' not found.' 
 C                   When      QUSEI = 'CPF2213' 
 C                   Eval      #Message = 'Not able to allocate ' + 
 C                                        'user profile ' +  %trim(pUser) 
 C                   When      QUSEI = 'CPF2225' 
 C                   Eval      #Message = 'Not able to allocate internal ' + 
 C                                        'system object.' 
 C                   Endsl 
 
 C                   Else 
 C                   Eval      #Message = 'Login success.' 
 C                   Endif 
 * 
 C     #Message      dsply     pUser 
 
 c                   eval      *inlr = *on 
                
User Comments

Please login or register to add comments

<Previous   Next>