home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / ras.cab / cacheinfo.vbs < prev    next >
Text File  |  1999-11-04  |  23KB  |  656 lines

  1. '********************************************************************
  2. '*
  3. '* File:           CacheInfo.vbs
  4. '* Created:        March 1999
  5. '* Version:        1.0
  6. '*
  7. '*  Main Function:  Get the cache information for a machine.
  8. '*
  9. '*  CacheInfo.vbs  [/S <server>] [/U <username>] [/W <password>] 
  10. '*                 [/O <outputfile>]
  11. '*
  12. '* Copyright (C) 1999 Microsoft Corporation
  13. '*
  14. '********************************************************************
  15.  
  16. OPTION EXPLICIT
  17.  
  18.     'Define constants
  19.     CONST CONST_ERROR                   = 0
  20.     CONST CONST_WSCRIPT                 = 1
  21.     CONST CONST_CSCRIPT                 = 2
  22.     CONST CONST_SHOW_USAGE              = 3
  23.     CONST CONST_PROCEED                 = 4
  24.  
  25.     'Declare variables
  26.     Dim intOpMode, i
  27.     Dim strServer, strUserName, strPassword, strOutputFile
  28.  
  29.     'Make sure the host is csript, if not then abort
  30.     VerifyHostIsCscript()
  31.  
  32.     'Parse the command line
  33.     intOpMode = intParseCmdLine(strServer     ,  _
  34.                                 strUserName   ,  _
  35.                                 strPassword   ,  _
  36.                                 strOutputFile    )
  37.  
  38.  
  39.     Select Case intOpMode
  40.  
  41.         Case CONST_SHOW_USAGE
  42.             Call ShowUsage()
  43.  
  44.         Case CONST_PROCEED                 
  45.             Call GetCacheInfo(strServer     , _
  46.                               strOutputFile , _
  47.                               strUserName   , _
  48.                               strPassword     )
  49.  
  50.         Case CONST_ERROR
  51.             'Do Nothing
  52.  
  53.         Case Else                    'Default -- should never happen
  54.             Call Wscript.Echo("Error occurred in passing parameters.")
  55.  
  56.     End Select
  57.  
  58. '********************************************************************
  59. '* End of Script
  60. '********************************************************************
  61.  
  62. '********************************************************************
  63. '*
  64. '* Sub GetCacheInfo()
  65. '* Purpose: Get the cache information for a machine.
  66. '* Input:   strServer           a machine name
  67. '*          strUserName         the current user's name
  68. '*          strPassword         the current user's password
  69. '*          strOutputFile       an output file name
  70. '*
  71. '* Output:  Results are either printed on screen or saved in strOutputFile.
  72. '*
  73. '********************************************************************
  74. Private Sub GetCacheInfo(strServer, strOutputFile, strUserName, strPassword)
  75.  
  76.     ON ERROR RESUME NEXT
  77.  
  78.     Dim objFileSystem, objOutputFile, objService, objCacheSet, objCache
  79.     Dim strQuery, strMessage
  80.     Dim strWBEMClass, strErrorCorrectType, strLocation
  81.  
  82.     strWBEMClass = "Win32_CacheMemory"
  83.  
  84.     'Open a text file for output if the file is requested
  85.     If Not IsEmpty(strOutputFile) Then
  86.         If (NOT blnOpenFile(strOutputFile, objOutputFile)) Then
  87.             Call Wscript.Echo ("Could not open an output file.")
  88.             Exit Sub
  89.         End If
  90.     End If
  91.  
  92.     'Establish a connection with the server.
  93.     If blnConnect("root\cimv2" , _
  94.                    strUserName , _
  95.                    strPassword , _
  96.                    strServer   , _
  97.                    objService  ) Then
  98.         Call Wscript.Echo("")
  99.         Call Wscript.Echo("Please check the server name, " _
  100.                         & "credentials and WBEM Core.")
  101.         Exit Sub
  102.     End If
  103.  
  104.     'Get the set
  105.     Set objCacheSet = objService.InstancesOf(strWBEMClass)
  106.     If blnErrorOccurred("Could not obtain " & strWBEMClass & " instance.") Then
  107.         Exit Sub
  108.     End If
  109.  
  110.     If objCacheSet.Count = 0 Then
  111.         Call WriteLine("No cache information is available.", objOutputFile)    
  112.         Exit Sub
  113.     End If
  114.  
  115.     Call WriteLine("Cache information for Machine " & strServer, objOutputFile)
  116.     Call WriteLine("", objOutputFile)
  117.  
  118.     For Each objCache In objCacheSet
  119.         Select Case objCache.ErrorCorrectType
  120.             Case 0
  121.                 strErrorCorrectType = "Reserved"
  122.             Case 1
  123.                 strErrorCorrectType = "Other"
  124.             Case 2
  125.                 strErrorCorrectType = "Unknown"
  126.             Case 3
  127.                 strErrorCorrectType = "None"
  128.             Case 4
  129.                 strErrorCorrectType = "Parity"
  130.             Case 5
  131.                 strErrorCorrectType = "Single-bit ECC"
  132.             Case 6
  133.                 strErrorCorrectType = "Multi-bit ECC"
  134.         End Select
  135.         Select Case objCache.Location
  136.             Case 0
  137.                 strLocation = "Internal"
  138.             Case 1
  139.                 strLocation = "External"
  140.             Case 2
  141.                 strLocation = "Reserved"
  142.             Case 3
  143.                 strLocation = "Unknown"
  144.         End Select 
  145.  
  146.         Call WriteLine("Name               = " _
  147.                       & objCache.Name, objOutputFile)
  148.         Call WriteLine("Error Correct Type = " _
  149.                       & strErrorCorrectType, objOutputFile)
  150.         Call WriteLine("Location           = " _
  151.                       & strLocation, objOutputFile)
  152.         Call WriteLine("Max Cache Size     = " _
  153.                       & objCache.MaxCacheSize, objOutputFile)
  154.         Call WriteLine("", objOutputFile)
  155.     Next
  156.  
  157.     If IsObject(objOutputFile) Then
  158.         objOutputFile.Close
  159.         Call Wscript.Echo ("Results are saved in file " & strOutputFile & ".")
  160.     End If
  161.  
  162. End Sub
  163.  
  164. '********************************************************************
  165. '*
  166. '* Function intParseCmdLine()
  167. '*
  168. '* Purpose: Parses the command line.
  169. '* Input:   
  170. '*
  171. '* Output:  strServer         a remote server ("" = local server")
  172. '*          strUserName       the current user's name
  173. '*          strPassword       the current user's password
  174. '*          strOutputFile     an output file name
  175. '*
  176. '********************************************************************
  177. Private Function intParseCmdLine( ByRef strServer,        _
  178.                                   ByRef strUserName,      _
  179.                                   ByRef strPassword,      _
  180.                                   ByRef strOutputFile     )
  181.  
  182.  
  183.     ON ERROR RESUME NEXT
  184.  
  185.     Dim strFlag
  186.     Dim intState, intArgIter
  187.     Dim objFileSystem
  188.  
  189.     If Wscript.Arguments.Count > 0 Then
  190.         strFlag = Wscript.arguments.Item(0)
  191.     End If
  192.  
  193.     If IsEmpty(strFlag) Then                'No arguments have been received
  194.         intParseCmdLine = CONST_PROCEED
  195.         Exit Function
  196.     End If
  197.  
  198.     'Check if the user is asking for help or is just confused
  199.     If (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
  200.         OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") _ 
  201.         OR (strFlag="h") Then
  202.         intParseCmdLine = CONST_SHOW_USAGE
  203.         Exit Function
  204.     End If
  205.  
  206.     'Retrieve the command line and set appropriate variables
  207.      intArgIter = 0
  208.     Do While intArgIter <= Wscript.arguments.Count - 1
  209.         Select Case Left(LCase(Wscript.arguments.Item(intArgIter)),2)
  210.   
  211.             Case "/s"
  212.                 If Not blnGetArg("Server", strServer, intArgIter) Then
  213.                     intParseCmdLine = CONST_ERROR
  214.                     Exit Function
  215.                 End If
  216.                 intArgIter = intArgIter + 1
  217.  
  218.             Case "/o"
  219.                 If Not blnGetArg("Output File", strOutputFile, intArgIter) Then
  220.                     intParseCmdLine = CONST_ERROR
  221.                     Exit Function
  222.                 End If
  223.                 intArgIter = intArgIter + 1
  224.  
  225.             Case "/u"
  226.                 If Not blnGetArg("User Name", strUserName, intArgIter) Then
  227.                     intParseCmdLine = CONST_ERROR
  228.                     Exit Function
  229.                 End If
  230.                 intArgIter = intArgIter + 1
  231.  
  232.             Case "/w"
  233.                 If Not blnGetArg("User Password", strPassword, intArgIter) Then
  234.                     intParseCmdLine = CONST_ERROR
  235.                     Exit Function
  236.                 End If
  237.                 intArgIter = intArgIter + 1
  238.  
  239.             Case Else 'We shouldn't get here
  240.                 Call Wscript.Echo("Invalid or misplaced parameter: " _
  241.                    & Wscript.arguments.Item(intArgIter) & vbCRLF _
  242.                    & "Please check the input and try again," & vbCRLF _
  243.                    & "or invoke with '/?' for help with the syntax.")
  244.                 Wscript.Quit
  245.  
  246.         End Select
  247.  
  248.     Loop '** intArgIter <= Wscript.arguments.Count - 1
  249.  
  250.     If IsEmpty(intParseCmdLine) Then _
  251.         intParseCmdLine = CONST_PROCEED
  252.  
  253. End Function
  254.  
  255. '********************************************************************
  256. '*
  257. '* Sub ShowUsage()
  258. '*
  259. '* Purpose: Shows the correct usage to the user.
  260. '*
  261. '* Input:   None
  262. '*
  263. '* Output:  Help messages are displayed on screen.
  264. '*
  265. '********************************************************************
  266. Private Sub ShowUsage()
  267.  
  268.     Wscript.Echo ""
  269.     Wscript.Echo "Get the cache information for a machine."
  270.     Wscript.Echo ""
  271.     Wscript.Echo "SYNTAX:"
  272.     Wscript.Echo "  CacheInfo.vbs [/S <server>] [/U <username>]" _
  273.                 &" [/W <password>]"
  274.     Wscript.Echo "  [/O <outputfile>]"
  275.     Wscript.Echo ""
  276.     Wscript.Echo "PARAMETER SPECIFIERS:"
  277.     Wscript.Echo "   server        A machine name."
  278.     Wscript.Echo "   username      The current user's name."
  279.     Wscript.Echo "   password      Password of the current user."
  280.     Wscript.Echo "   outputfile    The output file name."
  281.     Wscript.Echo ""
  282.     Wscript.Echo "EXAMPLE:"
  283.     Wscript.Echo "1. cscript CacheInfo.vbs"
  284.     Wscript.Echo "   Get the cache information for the current machine."
  285.     Wscript.Echo "2. cscript CacheInfo.vbs /S MyMachine2"
  286.     Wscript.Echo "   Get the cache information for the machine MyMachine2."
  287.  
  288. End Sub
  289.  
  290. '********************************************************************
  291. '* General Routines
  292. '********************************************************************
  293.  
  294. '********************************************************************
  295. '*
  296. '* Function strPackString()
  297. '*
  298. '* Purpose: Attaches spaces to a string to increase the length to intWidth.
  299. '*
  300. '* Input:   strString   a string
  301. '*          intWidth    the intended length of the string
  302. '*          blnAfter    Should spaces be added after the string?
  303. '*          blnTruncate specifies whether to truncate the string or not if
  304. '*                      the string length is longer than intWidth
  305. '*
  306. '* Output:  strPackString is returned as the packed string.
  307. '*
  308. '********************************************************************
  309. Private Function strPackString( ByVal strString, _
  310.                                 ByVal intWidth,  _
  311.                                 ByVal blnAfter,  _
  312.                                 ByVal blnTruncate)
  313.  
  314.     ON ERROR RESUME NEXT
  315.  
  316.     intWidth      = CInt(intWidth)
  317.     blnAfter      = CBool(blnAfter)
  318.     blnTruncate   = CBool(blnTruncate)
  319.  
  320.     If Err.Number Then
  321.         Call Wscript.Echo ("Argument type is incorrect!")
  322.         Err.Clear
  323.         Wscript.Quit
  324.     End If
  325.  
  326.     If IsNull(strString) Then
  327.         strPackString = "null" & Space(intWidth-4)
  328.         Exit Function
  329.     End If
  330.  
  331.     strString = CStr(strString)
  332.     If Err.Number Then
  333.         Call Wscript.Echo ("Argument type is incorrect!")
  334.         Err.Clear
  335.         Wscript.Quit
  336.     End If
  337.  
  338.     If intWidth > Len(strString) Then
  339.         If blnAfter Then
  340.             strPackString = strString & Space(intWidth-Len(strString))
  341.         Else
  342.             strPackString = Space(intWidth-Len(strString)) & strString & " "
  343.         End If
  344.     Else
  345.         If blnTruncate Then
  346.             strPackString = Left(strString, intWidth-1) & " "
  347.         Else
  348.             strPackString = strString & " "
  349.         End If
  350.     End If
  351.  
  352. End Function
  353.  
  354. '********************************************************************
  355. '* 
  356. '*  Function blnGetArg()
  357. '*
  358. '*  Purpose: Helper to intParseCmdLine()
  359. '* 
  360. '*  Usage:
  361. '*
  362. '*     Case "/s" 
  363. '*       blnGetArg ("server name", strServer, intArgIter)
  364. '*
  365. '********************************************************************
  366. Private Function blnGetArg ( ByVal StrVarName,   _
  367.                              ByRef strVar,       _
  368.                              ByRef intArgIter) 
  369.  
  370.     blnGetArg = False 'failure, changed to True upon successful completion
  371.  
  372.     If Len(Wscript.Arguments(intArgIter)) > 2 then
  373.         If Mid(Wscript.Arguments(intArgIter),3,1) = ":" then
  374.             If Len(Wscript.Arguments(intArgIter)) > 3 then
  375.                 strVar = Right(Wscript.Arguments(intArgIter), _
  376.                          Len(Wscript.Arguments(intArgIter)) - 3)
  377.                 blnGetArg = True
  378.                 Exit Function
  379.             Else
  380.                 intArgIter = intArgIter + 1
  381.                 If intArgIter > (Wscript.Arguments.Count - 1) Then
  382.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  383.                     Call Wscript.Echo( "Please check the input and try again.")
  384.                     Exit Function
  385.                 End If
  386.  
  387.                 strVar = Wscript.Arguments.Item(intArgIter)
  388.                 If Err.Number Then
  389.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  390.                     Call Wscript.Echo( "Please check the input and try again.")
  391.                     Exit Function
  392.                 End If
  393.  
  394.                 If InStr(strVar, "/") Then
  395.                     Call Wscript.Echo( "Invalid " & StrVarName)
  396.                     Call Wscript.Echo( "Please check the input and try again.")
  397.                     Exit Function
  398.                 End If
  399.  
  400.                 blnGetArg = True 'success
  401.             End If
  402.         Else
  403.             strVar = Right(Wscript.Arguments(intArgIter), _
  404.                      Len(Wscript.Arguments(intArgIter)) - 2)
  405.             blnGetArg = True 'success
  406.             Exit Function
  407.         End If
  408.     Else
  409.         intArgIter = intArgIter + 1
  410.         If intArgIter > (Wscript.Arguments.Count - 1) Then
  411.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  412.             Call Wscript.Echo( "Please check the input and try again.")
  413.             Exit Function
  414.         End If
  415.  
  416.         strVar = Wscript.Arguments.Item(intArgIter)
  417.         If Err.Number Then
  418.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  419.             Call Wscript.Echo( "Please check the input and try again.")
  420.             Exit Function
  421.         End If
  422.  
  423.         If InStr(strVar, "/") Then
  424.             Call Wscript.Echo( "Invalid " & StrVarName)
  425.             Call Wscript.Echo( "Please check the input and try again.")
  426.             Exit Function
  427.         End If
  428.         blnGetArg = True 'success
  429.     End If
  430. End Function
  431.  
  432. '********************************************************************
  433. '*
  434. '* Function blnConnect()
  435. '*
  436. '* Purpose: Connects to machine strServer.
  437. '*
  438. '* Input:   strServer       a machine name
  439. '*          strNameSpace    a namespace
  440. '*          strUserName     name of the current user
  441. '*          strPassword     password of the current user
  442. '*
  443. '* Output:  objService is returned  as a service object.
  444. '*          strServer is set to local host if left unspecified
  445. '*
  446. '********************************************************************
  447. Private Function blnConnect(ByVal strNameSpace, _
  448.                             ByVal strUserName,  _
  449.                             ByVal strPassword,  _
  450.                             ByRef strServer,    _
  451.                             ByRef objService)
  452.  
  453.     ON ERROR RESUME NEXT
  454.  
  455.     Dim objLocator, objWshNet
  456.  
  457.     blnConnect = False     'There is no error.
  458.  
  459.     'Create Locator object to connect to remote CIM object manager
  460.     Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  461.     If Err.Number then
  462.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  463.                            " occurred in creating a locator object." )
  464.         If Err.Description <> "" Then
  465.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  466.         End If
  467.         Err.Clear
  468.         blnConnect = True     'An error occurred
  469.         Exit Function
  470.     End If
  471.  
  472.     'Connect to the namespace which is either local or remote
  473.     Set objService = objLocator.ConnectServer (strServer, strNameSpace, _
  474.        strUserName, strPassword)
  475.     ObjService.Security_.impersonationlevel = 3
  476.     If Err.Number then
  477.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  478.                            " occurred in connecting to server " _
  479.            & strServer & ".")
  480.         If Err.Description <> "" Then
  481.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  482.         End If
  483.         Err.Clear
  484.         blnConnect = True     'An error occurred
  485.     End If
  486.  
  487.     'Get the current server's name if left unspecified
  488.     If IsEmpty(strServer) Then
  489.         Set objWshNet = CreateObject("Wscript.Network")
  490.     strServer     = objWshNet.ComputerName
  491.     End If
  492.  
  493. End Function
  494.  
  495. '********************************************************************
  496. '*
  497. '* Sub      VerifyHostIsCscript()
  498. '*
  499. '* Purpose: Determines which program is used to run this script.
  500. '*
  501. '* Input:   None
  502. '*
  503. '* Output:  If host is not cscript, then an error message is printed 
  504. '*          and the script is aborted.
  505. '*
  506. '********************************************************************
  507. Sub VerifyHostIsCscript()
  508.  
  509.     ON ERROR RESUME NEXT
  510.  
  511.     Dim strFullName, strCommand, i, j, intStatus
  512.  
  513.     strFullName = WScript.FullName
  514.  
  515.     If Err.Number then
  516.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & " occurred." )
  517.         If Err.Description <> "" Then
  518.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  519.         End If
  520.         intStatus =  CONST_ERROR
  521.     End If
  522.  
  523.     i = InStr(1, strFullName, ".exe", 1)
  524.     If i = 0 Then
  525.         intStatus =  CONST_ERROR
  526.     Else
  527.         j = InStrRev(strFullName, "\", i, 1)
  528.         If j = 0 Then
  529.             intStatus =  CONST_ERROR
  530.         Else
  531.             strCommand = Mid(strFullName, j+1, i-j-1)
  532.             Select Case LCase(strCommand)
  533.                 Case "cscript"
  534.                     intStatus = CONST_CSCRIPT
  535.                 Case "wscript"
  536.                     intStatus = CONST_WSCRIPT
  537.                 Case Else       'should never happen
  538.                     Call Wscript.Echo( "An unexpected program was used to " _
  539.                                        & "run this script." )
  540.                     Call Wscript.Echo( "Only CScript.Exe or WScript.Exe can " _
  541.                                        & "be used to run this script." )
  542.                     intStatus = CONST_ERROR
  543.                 End Select
  544.         End If
  545.     End If
  546.  
  547.     If intStatus <> CONST_CSCRIPT Then
  548.         Call WScript.Echo( "Please run this script using CScript." & vbCRLF & _
  549.              "This can be achieved by" & vbCRLF & _
  550.              "1. Using ""CScript cacheinfo.vbs arguments"" for Windows 95/98 or" _
  551.              & vbCRLF & "2. Changing the default Windows Scripting Host " _
  552.              & "setting to CScript" & vbCRLF & "    using ""CScript " _
  553.              & "//H:CScript //S"" and running the script using" & vbCRLF & _
  554.              "    ""CacheInfo.vbs arguments"" for Windows NT/2000." )
  555.         WScript.Quit
  556.     End If
  557.  
  558. End Sub
  559.  
  560. '********************************************************************
  561. '*
  562. '* Sub WriteLine()
  563. '* Purpose: Writes a text line either to a file or on screen.
  564. '* Input:   strMessage  the string to print
  565. '*          objFile     an output file object
  566. '* Output:  strMessage is either displayed on screen or written to a file.
  567. '*
  568. '********************************************************************
  569. Sub WriteLine(ByVal strMessage, ByVal objFile)
  570.  
  571.     On Error Resume Next
  572.     If IsObject(objFile) then        'objFile should be a file object
  573.         objFile.WriteLine strMessage
  574.     Else
  575.         Call Wscript.Echo( strMessage )
  576.     End If
  577.  
  578. End Sub
  579.  
  580. '********************************************************************
  581. '* 
  582. '* Function blnErrorOccurred()
  583. '*
  584. '* Purpose: Reports error with a string saying what the error occurred in.
  585. '*
  586. '* Input:   strIn        string saying what the error occurred in.
  587. '*
  588. '* Output:  displayed on screen 
  589. '* 
  590. '********************************************************************
  591. Private Function blnErrorOccurred (ByVal strIn)
  592.  
  593.     If Err.Number Then
  594.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & ": " & strIn)
  595.         If Err.Description <> "" Then
  596.             Call Wscript.Echo( "Error description: " & Err.Description)
  597.         End If
  598.         Err.Clear
  599.         blnErrorOccurred = True
  600.     Else
  601.         blnErrorOccurred = False
  602.     End If
  603.  
  604. End Function
  605.  
  606. '********************************************************************
  607. '* 
  608. '* Function blnOpenFile
  609. '*
  610. '* Purpose: Opens a file.
  611. '*
  612. '* Input:   strFileName        A string with the name of the file.
  613. '*
  614. '* Output:  Sets objOpenFile to a FileSystemObject and setis it to 
  615. '*            Nothing upon Failure.
  616. '* 
  617. '********************************************************************
  618. Private Function blnOpenFile(ByVal strFileName, ByRef objOpenFile)
  619.  
  620.     ON ERROR RESUME NEXT
  621.  
  622.     Dim objFileSystem
  623.  
  624.     Set objFileSystem = Nothing
  625.  
  626.     If IsEmpty(strFileName) OR strFileName = "" Then
  627.         blnOpenFile = False
  628.         Set objOpenFile = Nothing
  629.         Exit Function
  630.     End If
  631.  
  632.     'Create a file object
  633.     Set objFileSystem = CreateObject("Scripting.FileSystemObject")
  634.     If blnErrorOccurred("Could not create filesystem object.") Then
  635.         blnOpenFile = False
  636.         Set objOpenFile = Nothing
  637.         Exit Function
  638.     End If
  639.  
  640.     'Open the file for output
  641.     Set objOpenFile = objFileSystem.OpenTextFile(strFileName, 8, True)
  642.     If blnErrorOccurred("Could not open") Then
  643.         blnOpenFile = False
  644.         Set objOpenFile = Nothing
  645.         Exit Function
  646.     End If
  647.     blnOpenFile = True
  648.  
  649. End Function
  650.  
  651. '********************************************************************
  652. '*                                                                  *
  653. '*                           End of File                            *
  654. '*                                                                  *
  655. '********************************************************************
  656.