/// <summary>
        /// Constructs a new EbcdicWriter
        /// </summary>
        /// <param name="outputStream">the stream to read from</param>
        /// <param name="charset">encoding to use for writing</param>
        /// <param name="writeRdw"> whether a record descriptor word (RDW) should be written with each record</param>
        /// <param name="filler"></param>
        public EbcdicWriter(Stream outputStream, string charset, bool writeRdw, EbcdicEncoder.DefaultValue filler)
        {
            _stream = outputStream;

            _encoder = new EbcdicEncoder(charset)
            {
                DefVal = filler
            };
            _writeRdw = writeRdw;
        }
        public void EbcdicTestsTest()
        {
            FieldFormat binary = new FieldFormat
            {
                Decimal = 0,
                Size    = "6",
                Type    = "B"
            };
            EbcdicEncoder encoder = new EbcdicEncoder("ascii");
            EbcdicDecoder decoder = new EbcdicDecoder("ascii");

            decimal value1 = -1937m;
            decimal value2 = 1937m;

            Assert.AreEqual(value1, decoder.Decode(encoder.Encode(value1, binary), binary));
            Assert.AreEqual(value2, decoder.Decode(encoder.Encode(value2, binary), binary));
        }
 /// <summary>
 /// Sets a value on a record.
 /// </summary>
 /// <param name="record">the record to set the value on</param>
 /// <param name="value">the value to set</param>
 public override void Set(byte[] record, decimal value)
 {
     SetBytes(record, EbcdicEncoder.EncodePacked(value, Length), 0);
 }
 /// <summary>
 /// Sets a value on a record.
 /// </summary>
 /// <param name="record">the record to set the value on</param>
 /// <param name="value">the value to set</param>
 public override void Set(byte[] record, decimal value)
 {
     SetBytes(record, Encoding.GetBytes(EbcdicEncoder.EncodeZoned(value, Length)), Encoding.GetBytes("0")[0]);
 }
 public void Before()
 {
     _encoder = new EbcdicEncoder("ascii");
 }