home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / QMS / RDQSTAT.PRG < prev    next >
Text File  |  1993-02-23  |  4KB  |  125 lines

  1. /*
  2.  * File......: RDQSTAT.PRG
  3.  * Author....: Glenn Scott
  4.  * CIS ID....: 71620,1521
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  * 
  9.  * This is an original work by Glenn Scott and is placed in the
  10.  * public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *     FN_RDQSTA()
  23.  *  $CATEGORY$
  24.  *     Queue
  25.  *  $ONELINER$
  26.  *     Read queue current status
  27.  *  $SYNTAX$
  28.  *
  29.  *     fn_rdQSta( nQueueID ) -> aStatStruct
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *    <nQueueID> is the bindery object ID for the queue
  34.  *
  35.  *  $RETURNS$
  36.  *
  37.  *    <aStatStruct>, an array structured as follows:
  38.  *
  39.  *       Index                        Contents
  40.  *       -----     ---------------------------------------------
  41.  *
  42.  *         1         Queue ID  (numeric) - the bindery object ID
  43.  *                   of the Queue
  44.  *         2         Job Add? (logical) - If false, the operator
  45.  *                   has indicated no new jobs should be added to
  46.  *                   the queue
  47.  *         3         Server attach? (logical) - If false, the 
  48.  *                   operator has indicated no additional job 
  49.  *                   servers should attach to the queue
  50.  *         4         Service jobs? (logical) - If false, the
  51.  *                   operator has indicated no jobs should be 
  52.  *                   serviced in the queue (like a hold).
  53.  *         5         NumJobs (numeric) - the number of jobs 
  54.  *                   currently in the queue
  55.  *         6         NumServers (numeric) - the number of servers
  56.  *                   currently attached that can service the queue
  57.  *         7         Server ID List (array) - an array of 
  58.  *                   bindery object IDs (numerics) of the servers
  59.  *                   currently attached that can service the queue
  60.  *         8         Sever Station List (array) - an array of 
  61.  *                   station IDs (numerics) of the servers currently
  62.  *                   attached that can service the queue
  63.  *         9         MaxServers (numeric) - 
  64.  *
  65.  *
  66.  *  $DESCRIPTION$
  67.  *
  68.  *  $EXAMPLES$
  69.  *
  70.  *  $SEEALSO$
  71.  *
  72.  *  $INCLUDE$
  73.  *
  74.  *  $END$
  75.  */
  76.  
  77. #include "netto.ch"
  78.  
  79. function fn_rdQSta( nQueueID )
  80.    local cReq, cRep, aStat := {}, nX, nNumServ, aSid := {}, aSSta := {}, nOffset
  81.  
  82.    if pcount() == 1 .and. valtype( nQueueID ) == "N"
  83.  
  84.       cReq := I2BYTE( 102 ) + L2HILO( nQueueID )
  85.       cRep := repl( chr(0), 133 )
  86.  
  87.       if _fnReq( 227, cReq, @cRep ) == ESUCCESS
  88.  
  89.          nNumServ := BYTE2I( subs( cRep, 7, 1 ) )        // Number of servers
  90.  
  91.          aStat := { HILO2L( subs( cRep, 1, 4 ) ),      ;      // Queue ID
  92.                     ft_isbit( subs( cRep, 5, 1),  0 ), ;      // Job add?
  93.                     ft_isbit( subs( cRep, 5, 1),  1 ), ;      // Server attach?
  94.                     ft_isbit( subs( cRep, 5, 1),  2 ), ;      // Service jobs?
  95.                     BYTE2I( subs( cRep, 6, 1 ) ),      ;      // Number of jobs
  96.                     nNumServ,                          ;      // Number of servers
  97.                     {},                                ;      // Server ID List
  98.                     {},                                ;      // Server Stations List
  99.                     BYTE2I( subs( cRep, len( cRep ) ) );      // Max servers
  100.                   }
  101.  
  102.  
  103.          if nNumServ > 0
  104.             nOffSet := 8
  105.  
  106.             for nX := 1 to nNumServ
  107.                aadd( aStat[7], HILO2L( subs( cRep, nOffset, 4 ) ) )
  108.                nOffset += 4
  109.             next
  110.  
  111.             for nX := 1 to nNumServ
  112.                aadd( aStat[8], BYTE2I( subs( cRep, nOffset++, 1 ) ) )
  113.             next
  114.  
  115.          endif
  116.  
  117.       endif
  118.  
  119.    else
  120.       _fnSetErr( EBADPARM )
  121.    endif
  122.  
  123.    return aStat
  124.  
  125.