/*---------------------------------------------------------------------------*\
|   Check Password replication                (C) Alain Rykaert - DEC97-APR98 |
\*---------------------------------------------------------------------------*/
    Version = '1.01'
         /* it's hard to say, but thanks to jacques from morgan euroclear */
    Say '* CHKPWD Version' Version

    Call Init                                 /* init dll's and other stuff*/
    Call SysCls

    OutFile = 'CHKUSER.LOG'                              /* Output filename*/

    TempFile = LSRDrive'\ibmlan\chkpwd.txt'               /* temporary file*/
    Say '* Temporary file:' TempFile

/*===================================*/
    DCName = 'serv0100'
    UserID = '$pol'
/*===================================*/

    RC = NetGetInfo(340, 'Server', '\\'DCName, 'Servers')
    If RC = 0
      Then Do
             Call RxStemSort 'Server'
             Say '* Total Defined servers:' Server.0
             Say '* Scanning active servers...'
             Call SysCurState Off
             Parse Value SysCurPos() With Row Col
             j = 0
             Do i = 1 to Server.0
               Call SysCurPos Row, 0
               Color = Random(41,46)
               Say ' ' i
               If Stream('\\'Server.i'\ibmlan$\ibmlan.ini', 'C','Query Exists') <> ''
                 Then Do
                        j = j + 1
                        ServerName.j = Server.i
                      End
                 Else Nop
             End
           End
      Else Call ChkError RC

    ServerName.0 = j

    Do i = 1 to ServerName.0                   /* Reset all status counters*/
      Status.i = ''
    End

    OutText = '* Total active servers:' ServerName.0
    Say OutText
    Call LineOut OutFile, OutText
    Call Stream  OutFile, 'C', 'Close'

    Call Time('R')
    Found = 0
    Loop = 0
    Do Forever
      If Found = ServerName.0              /* if all servers ok, then leave*/
        Then Leave
        Else Nop
      Say Copies('-', 40) 'Loop:' Loop
      Do i = 1 to ServerName.0
        If Status.i <> 'OK'
          Then Do
                 RC = NetGetInfo(280, 'UserInfo', '\\'ServerName.i, UserID)
                 If RC = 0
                   Then Do
                          Status.i = 'OK'
                          Found = Found + 1
                          Call Beep 2000,50
                          Call LineOut OutFile, Time() ServerName.i
                          Call Stream  OutFile, 'C', 'Close'
                        End
                   Else Nop
                 Say '* ServerName:' i Left(ServerName.i,9) Status.i
               End
          Else Nop
      End
      Loop = Loop + 1
      Call SysSleep 1
    End
    Say '* Total Time:' Trunc(Time('E'),2)

    Exit

 INIT:/* --------------------------------------------------------------------*/

   '@echo off'
    BootDrive = Left(Value('Comspec',,'OS2Environment'),2)

    If RxFuncQuery('SysLoadFuncs')
      Then Do
             Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
             Call SysLoadFuncs
           End
      Else Nop

    LSRDrive = ''                      /* Check for Lan Server Drive Letter*/
    PPath = Translate(Value('DPATH',,'OS2Environment'))
    x = Pos('\IBMLAN\NETPROG;', PPath) -2
    If x > 0
      Then Do
             LSRDrive = SubStr(PPath, x, 2)
             Say '* LanServer Drive:' LSRDrive
           End
      Else Do
             Say '* Could not determine the Lan Requester path'
             Exit
           End

    Call ChkFile LSRDrive'\ibmlan\netlib\lsrxut.dll'
    If RxFuncQuery('LoadLSRXUTFuncs')
      Then Do
             Call RxFuncAdd LoadLsRxutFuncs, LSRXUT, LoadLsRxutFuncs
             Call LoadLsRxutFuncs
           End
      Else Nop

    Call ChkFile BootDrive'\os2\dll\rxutils.dll'
    If RxFuncQuery('RxLoadFuncs')
      Then Do
             Call RxFuncAdd RxLoadFuncs, RXUTILS, RxLoadFuncs
             Call RxLoadFuncs
           End
      Else Nop

    Return

 CHKERROR:/* ----------------------------------------------------------------*/

    Parse Arg RCode

    Say '* Error:' RCode
    Exit X2D('1600')

    Return

 CHKFILE:/* -----------------------------------------------------------------*/

    Parse Arg File_To_Check

    If Stream(File_To_Check, 'C', 'Query Exists') = ''
      Then Do
             Say '! File not found:' File_To_Check
             Exit
           End
      Else Nop

    Return

