//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void setParameterOutputData(final int parmIndex, final byte[] tempData, final int maxLength)
        public virtual void setParameterOutputData(int parmIndex, sbyte[] tempData, int maxLength)
        {
            switch (parmIndex)
            {
            case 0:
                if (formatter_ != null)
                {
                    formatter_.format(tempData, maxLength, recordLength_, formatListener_);
                }
                break;

            case 3:
                if (maxLength < 12)
                {
                    info_ = null;
                }
                else
                {
                    info_ = Util.readOpenListInformationParameter(tempData, maxLength);
                }
                break;

            default:
                break;
            }
        }
 public virtual void newCall()
 {
     info_ = null;
 }
Example #3
0
        /// <summary>
        /// Calls the OpenListProgram, then loops calling GetListEntries, then finally calls CloseList. </summary>
        /// <param name="conn"> The connection to use. </param>
        /// <param name="numRecordsToReturn"> The number of records the GetListEntries call should return each time.
        ///  </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void process(CommandConnection conn, int numRecordsToReturn) throws IOException
        public virtual void process(CommandConnection conn, int numRecordsToReturn)
        {
            CommandResult result = conn.call(program_);

            if (!result.succeeded())
            {
                throw new IOException("Open list failed: " + result.ToString());
            }

            ListInformation listInfo = program_.ListInformation;

            sbyte[] requestHandle = listInfo.RequestHandle;
            close_.RequestHandle = requestHandle;

            if (listener_ != null)
            {
                listener_.openComplete();
            }

            try
            {
                int recordLength = listInfo.RecordLength;
                // Now, the list is building on the server.
                // Call GetListEntries once to wait for the list to finish building, for example.
                int receiverSize   = 8;
                int startingRecord = -1;
                getEntries_.LengthOfReceiverVariable = receiverSize;
                getEntries_.RequestHandle            = requestHandle;
                getEntries_.RecordLength             = recordLength;
                getEntries_.NumberOfRecordsToReturn  = 0;
                getEntries_.StartingRecord           = startingRecord;
                getEntries_.FormatListener           = null;
                result = conn.call(getEntries_);
                if (!result.succeeded())
                {
                    throw new IOException("Get list entries failed: " + result.ToString());
                }

                listInfo = getEntries_.ListInformation;
                int totalRecords = listInfo.TotalRecords;
                if (listener_ != null)
                {
                    listener_.totalRecordsInList(totalRecords);
                }

                // Now retrieve each object record in chunks of 800 at a time.
                receiverSize = recordLength * numRecordsToReturn;
                if (receiverSize <= 0)
                {
                    receiverSize = 100000;
                }
                startingRecord = 1;
                getEntries_.LengthOfReceiverVariable = receiverSize;
                getEntries_.NumberOfRecordsToReturn  = numRecordsToReturn;
                getEntries_.StartingRecord           = startingRecord;
                getEntries_.FormatListener           = listener_; // Ready to process.
                if (listener_ != null)
                {
                    while (!listener_.stopProcessing() && startingRecord <= totalRecords)
                    {
                        result = conn.call(getEntries_);
                        if (!result.succeeded())
                        {
                            throw new IOException("Get objects failed: " + result.ToString());
                        }
                        // Assuming it succeeded.
                        listInfo                   = getEntries_.ListInformation;
                        startingRecord            += listInfo.RecordsReturned;
                        getEntries_.StartingRecord = startingRecord;
                    }
                }
            }
            finally
            {
                conn.call(close_);
            }
        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public static ListInformation readOpenListInformationParameter(final byte[] data, final int maxLength)
        public static ListInformation readOpenListInformationParameter(sbyte[] data, int maxLength)   //throws IOException
        {
            ListInformation info    = null;
            int             numRead = 0;

            if (maxLength >= 12)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int totalRecords = Conv.byteArrayToInt(data, numRead);
                int totalRecords = Conv.byteArrayToInt(data, numRead);
                numRead += 4;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int recordsReturned = Conv.byteArrayToInt(data, numRead);
                int recordsReturned = Conv.byteArrayToInt(data, numRead);
                numRead += 4;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final byte[] handle = new byte[4];
                sbyte[] handle = new sbyte[4];
                //in.readFully(handle);
                Array.Copy(data, numRead, handle, 0, 4);
                numRead += 4;

                int    recordLength         = 0;
                int    infoCompleteType     = ListInformation.TYPE_UNKNOWN;
                string creationDate         = null;
                int    status               = ListInformation.STATUS_UNKNOWN;
                int    lengthOfInfoReturned = 0;
                int    firstRecord          = 0;

                if (maxLength >= 31)
                {
                    recordLength = Conv.byteArrayToInt(data, numRead);
                    numRead     += 4;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int infoComplete = data[numRead++] & 0x00FF;
                    int infoComplete = data[numRead++] & 0x00FF;
                    switch (infoComplete)
                    {
                    case 0x00C3:
                        infoCompleteType = ListInformation.TYPE_COMPLETE;
                        break;

                    case 0x00C9:
                        infoCompleteType = ListInformation.TYPE_INCOMPLETE;
                        break;

                    case 0x00D7:
                        infoCompleteType = ListInformation.TYPE_PARTIAL;
                        break;
                    }
                    //        final byte[] created = new byte[13];
                    //        in.readFully(created);
                    //        creationDate = new String(created, "Cp037");
                    creationDate = Conv.ebcdicByteArrayToString(data, numRead, 13);
                    numRead     += 13;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int listStatus = data[numRead++] & 0x00FF;
                    int listStatus = data[numRead++] & 0x00FF;
                    switch (listStatus)
                    {
                    case 0x00F0:
                        status = ListInformation.STATUS_PENDING;
                        break;

                    case 0x00F1:
                        status = ListInformation.STATUS_BUILDING;
                        break;

                    case 0x00F2:
                        status = ListInformation.STATUS_BUILT;
                        break;

                    case 0x00F3:
                        status = ListInformation.STATUS_ERROR;
                        break;

                    case 0x00F4:
                        status = ListInformation.STATUS_PRIMED;
                        break;

                    case 0x00F5:
                        status = ListInformation.STATUS_OVERFLOW;
                        break;
                    }
                    numRead += 19;
                    if (maxLength >= 40)
                    {
                        //in.read();
                        numRead++;
                        lengthOfInfoReturned = Conv.byteArrayToInt(data, numRead);
                        numRead    += 4;
                        firstRecord = Conv.byteArrayToInt(data, numRead);
                        numRead    += 4;
                    }
                }
                info = new ListInformation(totalRecords, recordsReturned, handle, recordLength, infoCompleteType, creationDate, status, lengthOfInfoReturned, firstRecord);
            }
            //    in.skipBytes(maxLength-numRead);
            return(info);
        }