home *** CD-ROM | disk | FTP | other *** search
- // LICDNLSR.SCP - Script to analyse the licence data collected by
- // the LICDCOLL.SCP script.
- // Copyright (c) 2000, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 5.3 2-Aug-00 AB - Created.
-
- // Script to analyse data collected by the LIDCOLL.SCP script and
- // check that there are enough licences for the number of clients.
-
- $INCLUDE "GTCTLDIR.SCP"
- $INCLUDE "PARSE.SCP"
- $INCLUDE "RINSTR.SCP"
-
- Function Main ()
- Dim Handle1, LicDataDir as String, LicenceList as List, Licence as String
- Dim a as Integer, SerialNo as String, MClients as String, MaxClients
- Dim Line as String, TotalLicences, TotalActClnts, TotalMaxClnts
-
- // Initialise the variables that count the total number
- // of Clients and maximum licences for Clients.
-
- TotalActClnts = 0
- TotalMaxClnts = 0
- TotalLicences = 0
-
- // Open the LICENCE.LST file and for each licence check the
- // number of clients and the maimum number of clients allowed.
- // Remember the data files are stored in a subdirectory.
-
- LicDataDir = GetControlDir ()
- LicDataDir = LicDataDir + "\LICDATA"
-
- Handle1 = Open (LicDataDir + "\LICENCE.LST", FILE_READ)
- If Handle1 then
-
- // Read the contents of the LICENCE.LST file into a list.
-
- Do until EOF (Handle1)
- Line = ReadLine (Handle1)
- AddItem (LicenceList, Line)
- loop
-
- Close (Handle1)
-
- For each Licence in LicenceList
- TotalLicences = TotalLicences + 1
-
- // Examine each licence to find the serial number and
- // maximum number of Clients. Then find out from the licences
- // list file how many clients are actually using the licence.
-
- a = InStr (Licence, "|")
- SerialNo = Left (Licence, a - 1)
- b = Len (Licence)
- b = b - a
- MClients = Right (Licence, b)
- MaxClients = CInt (MClients)
- LicListFl = LicDataDir + "\" + SerialNo + ".LST"
- ActualClients = 0
-
- Print "Analysing licence: ", SerialNo
-
- Handle2 = Open (LicListFl, FILE_READ)
- If Handle2 then
- Do until EOF (Handle2)
- ReadLine (Handle2)
- ActualClients = ActualClients + 1
- loop
- Close (Handle2)
- endif
-
- Print " Licensed Clients: ", MaxClients, " Actual Clients: ", ActualClients
- If ActualClients <= MaxClients then
- Print " Licence ", SerialNo, " has ", MaxClients - ActualClients, " unused licences."
- Else
- Print
- Print "WARNING: Licence ", SerialNo, " has ", ActualClients - MaxClients, " unlicensed Clients!"
- Print
- Endif
-
- // Add the values to the counters.
-
- TotalMaxClnts = TotalMaxClnts + MaxClients
- TotalActClnts = TotalActClnts + ActualClients
- Next
-
- // Print the totals. If there are more clients than there are
- // licencs for, display a warning message.
-
- Print ""
- Print "Summary:"
- Print " Total number of licences: ", TotalLicences
- Print " Maximum licensed Clients: ", TotalMaxClnts
- Print " Actual number of Clients: ", TotalActClnts
- If TotalActClnts <= TotalMaxClnts then
- Print " You have a total of ", TotalMaxClnts - TotalActClnts, " unused licences."
- Else
- Print
- Print "WARNING: You have a total of ", TotalActClnts - TotalMaxClnts, " unlicensed Clients!"
- Print
- Endif
- else
- Print "Unable to read LICENCE.LST file!"
- endif
- End Function
-