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

Change Passwords Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   
     
   H INDENT('| ')  DATEDIT(*YMD)   DECEDIT(*JOBRUN) 
  H OPTION(*NODEBUGIO) DFTACTGRP(*NO)  ACTGRP(*NEW) 
   *------------------------------------------------------------------------- 
   * 
   *         Application      : Utility 
   *         Program Id       : CHGPWD 
   * 
   *         Title            : This program will change system  passwords 
   *          Description      : Program will  change user's system passwords 
   *                            can be called from  web, native programs. 
   * 
   *         Parameters       : UserID           - User ID 
   *                            OldPassword      - Old password of user 
   *                            NewPassword      - New Password of user 
   *                            ErrorCode        - Error Code 
   *                            ErrorDescription - Description  of the error 
   * 
   *         Return Values    : 0 = Change Successful 
   *                            1 = Error in change  Password 
   * 
   *         Author           : Chamara Withanachchi 
   *         Date             : 2009/06/24 
   *         Version          : V 1.0 
   * 
   *------------------------------------------------------------------------- 
   *         MODIFICATIONS    : 
   *------------------------------------------------------------------------- 
   *------------------------------------------------------------------------- 
    /TITLE               ..... File specifications ..... 
   *------------------------------------------------------------------------- 
   *------------------------------------------------------------------------- 
    /TITLE               ..... Data specifications ..... 
   *------------------------------------------------------------------------- 
  D APIErrorDS      DS 
  D   BytesProvided                10I 0 Inz( %Size( APIErrorDS ) ) 
  D   BytesAvail                   10I 0 Inz( *Zero ) 
  D   MsgID                         7    Inz( *Blanks ) 
  D                                1    Inz( X'00' ) 
  D   MsgDta                      256    Inz( *Blanks ) 
  D GetMsg          PR                   extpgm('QMHRTVM') 
  D   Receiver                      1 
  D   SizRcv                       10i 0 const 
  D   Format                        8    const 
  D   MsgID                         7    const 
  D   Msgf                         20    const 
  D   RplData                       1    const 
  D   SizRplDta                    10i 0 const 
  D   RplSubVal                    10    const 
  D   RtnCtls                      10    const 
  D   ErrCod                       10i 0 const 
  D GetSize         DS 
  D   GetBytRtn                    10i 0 
  D   GetBytAvl                    10i 0 
  D Fmt0400         DS                   based(FmtPtr) 
  D   BytRtn                       10i 0 
  D   BytAvl                       10i 0 
  D   MaxRpyLen            117     120i 0 
  D   OffVldRpy            125     128i 0 
  D   NbrVldRpyR           129     132i 0 
  D   LenVldRpyR           133     136i 0 
  D   LenVldRpyA           137     140i 0 
  D   LenVldRpyE           141     144i 0 
  D   MessageDes           264     340 
  D VldRpyE         S             32    based(VldRpyPtr) 
  D dotPos          S              3  0 
   *------------------------------------------------------------------------- 
   * Entry  Parameters 
   *------------------------------------------------------------------------- 
  D ChangePwd       PR                   ExtPgm('CHGPWD') 
  D    UserId                      10A 
  D    OldPassword                128A 
  D    NewPassword                128A 
  D    ErrorCode                    1A 
  D    ErrorDescription... 
  D                               80A 
  D ChangePwd       PI 
  D    UserId                      10A 
  D    OldPassword                128A 
  D    NewPassword                128A 
  D    ErrorCode                    1A 
  D    ErrorDescription... 
  D                               80A 
   * Call API to  change the password 
  C                   Call      'QSYCHGPW' 
  C                   Parm                    UserId 
  C                   Parm                    OldPassword 
  C                   Parm                    NewPassword 
  C                   Parm                    APIErrorDS 
  C                   callp     GetMsg( GetSize       :%size(GetSize) 
  C                                    :'RTVM0400'    :MsgID 
  C                                    :'QCPFMSG   QSYS       ' 
  C                                    :'  '           :0 
  C                                    :'*NO'         :'*NO' 
  C                                    :0) 
  C                   eval      FmtPtr = %alloc(GetBytAvl) 
  C                   callp     GetMsg( Fmt0400       :GetBytAvl 
  C                                    :'RTVM0400'    :MsgID 
  C                                    :'QCPFMSG   QSYS       ' 
  C                                    :' '           :0 
  C                                    :'*NO'         :'*NO' 
  C                                    :0) 
   * Check any  Errors 
  C                   If        MsgID <> *Blanks 
  C                   Eval      ErrorCode = '1' 
  C                   Eval      dotPos = *Zeros 
  C                   Eval      dotPos = %Scan('.':MessageDes) 
  C                   Eval      ErrorDescription = %Subst(MessageDes : 2 
  C                                                       :dotPos - 1) 
  C                   Else 
  C                   Eval      ErrorCode = '0' 
  C                   Eval      ErrorDescription = *Blanks 
  C                   EndIf 
  C                   Eval      *INlr = *ON 
  C                   Return
 

 

 

User Comments

Please login or register to add comments

<Previous   Next>