Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JComLib.WriteManager"/> class for the
 /// given IO device, record index and format string.
 /// </summary>
 /// <param name="iodevice">The device to read from</param>
 /// <param name="record">The index of the record to write (for direct access)</param>
 /// <param name="formatString">Format string</param>
 public WriteManager(int iodevice, int record, string formatString)
 {
     _file = IOFile.Get(iodevice);
     if (_file == null) {
         _file = new IOFile(iodevice);
         _file.Open();
     }
     if (record >= 1) {
         _file.RecordIndex = record;
     }
     _file.IsFormatted = !string.IsNullOrEmpty(formatString);
     _format = new FormatManager(formatString);
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JComLib.ReadManager"/> class for the
 /// given IO device, record index and format string.
 /// </summary>
 /// <param name="iodevice">The device to read from</param>
 /// <param name="record">The index of the record to read (for direct access)</param>
 /// <param name="formatString">Format string</param>
 public ReadManager(int iodevice, int record, string formatString)
 {
     _file = IOFile.Get(iodevice);
     if (_file == null) {
         _file = new IOFile(iodevice);
         _file.Open();
     }
     if (record >= 1) {
         _file.RecordIndex = record;
     }
     if (formatString == "*") {
         formatString = string.Empty;
         _file.IsFormatted = true;
     } else {
         _file.IsFormatted = !string.IsNullOrEmpty(formatString);
     }
     _format = new FormatManager(formatString);
     _format.BlanksAsZero = (_file.Blank == 'Z');
     _readIndex = -1;
 }
Esempio n. 3
0
 /// <summary>
 /// ENDFILE keyword.
 /// For sequential files, writes an end-of-file record to the file and positions the file
 /// after this record (the terminal point). For direct access files, truncates the file
 /// after the current record.
 /// </summary>
 /// <param name="iodevice">The device number</param>
 /// <param name="iostat">A reference variable that will be set to the I/O status</param>
 /// <returns>A zero value if the operation succeeds, or -1 if the operation fails</returns>
 public static int ENDFILE(int iodevice, ref int iostat)
 {
     iostat = 0;
     IOFile iofile = IOFile.Get(iodevice);
     if (iofile == null) {
         iofile = new IOFile(iodevice);
         iofile.Open();
     }
     if (!iofile.EndFile()) {
         iostat = IOError.EndfileError;
         return -1;
     }
     return 0;
 }