Index: trunk/external-alma/atnf/PKSIO/NRODataset.cc
===================================================================
--- trunk/external-alma/atnf/PKSIO/NRODataset.cc	(revision 2782)
+++ trunk/external-alma/atnf/PKSIO/NRODataset.cc	(revision 2783)
@@ -67,5 +67,33 @@
     same_(-1),
     frec_()
-{}
+{
+  // size for common part of data 
+  datasize_ = sizeof( char ) * 8   // LOFIL
+    + sizeof( char ) * 8           // VER
+    + sizeof( char ) * 16          // GROUP
+    + sizeof( char ) * 16          // PROJ
+    + sizeof( char ) * 24          // SCHED
+    + sizeof( char ) * 40          // OBSVR
+    + sizeof( char ) * 16          // LOSTM
+    + sizeof( char ) * 16          // LOETM
+    + sizeof( int ) * 2            // ARYNM, NSCAN
+    + sizeof( char ) * 120         // TITLE
+    + sizeof( char ) * 16          // OBJ
+    + sizeof( char ) * 8           // EPOCH
+    + sizeof( double ) * 4         // RA0, DEC0, GLNG0, GLAT0
+    + sizeof( int ) * 2            // NCALB, SCNCD
+    + sizeof( char ) * 120         // SCMOD
+    + sizeof( double )             // URVEL
+    + sizeof( char ) * 4           // VREF
+    + sizeof( char ) * 4           // VDEF
+    + sizeof( char ) * 8           // SWMOD
+    + sizeof( double ) * 8         // FRQSW, DBEAM, MLTOF, CMTQ, CMTE, CMTSOM, CMTNODE, CMTI
+    + sizeof( char ) * 24          // CMTTM
+    + sizeof( double ) * 6         // SBDX, SBDY, SBDZ1, SBDZ2, DAZP, DELP
+    + sizeof( int ) * 4            // CHBIND, NUMCH, CHMIN, CHMAX
+    + sizeof( double ) * 3         // ALCTM, IPTIM, PA
+    + sizeof( int ) * 3            // SCNLEN, SBIND, IBIT
+    + sizeof( char ) * 8 ;         // SITE
+}
 
 // destructor 
@@ -80,5 +108,5 @@
 
 // data initialization
-void NRODataset::initialize()
+void NRODataset::initializeCommon()
 {
   LogIO os( LogOrigin( "NRODataset", "initialize()", WHERE ) ) ;
@@ -140,31 +168,4 @@
   }
 
-  datasize_ = sizeof( char ) * 8   // LOFIL
-    + sizeof( char ) * 8           // VER
-    + sizeof( char ) * 16          // GROUP
-    + sizeof( char ) * 16          // PROJ
-    + sizeof( char ) * 24          // SCHED
-    + sizeof( char ) * 40          // OBSVR
-    + sizeof( char ) * 16          // LOSTM
-    + sizeof( char ) * 16          // LOETM
-    + sizeof( int ) * 2            // ARYNM, NSCAN
-    + sizeof( char ) * 120         // TITLE
-    + sizeof( char ) * 16          // OBJ
-    + sizeof( char ) * 8           // EPOCH
-    + sizeof( double ) * 4         // RA0, DEC0, GLNG0, GLAT0
-    + sizeof( int ) * 2            // NCALB, SCNCD
-    + sizeof( char ) * 120         // SCMOD
-    + sizeof( double )             // URVEL
-    + sizeof( char ) * 4           // VREF
-    + sizeof( char ) * 4           // VDEF
-    + sizeof( char ) * 8           // SWMOD
-    + sizeof( double ) * 8         // FRQSW, DBEAM, MLTOF, CMTQ, CMTE, CMTSOM, CMTNODE, CMTI
-    + sizeof( char ) * 24          // CMTTM
-    + sizeof( double ) * 6         // SBDX, SBDY, SBDZ1, SBDZ2, DAZP, DELP
-    + sizeof( int ) * 4            // CHBIND, NUMCH, CHMIN, CHMAX
-    + sizeof( double ) * 3         // ALCTM, IPTIM, PA
-    + sizeof( int ) * 3            // SCNLEN, SBIND, IBIT
-    + sizeof( char ) * 8 ;         // SITE
-
   // NRODataRecord
   record_ = new NRODataRecord() ;
@@ -193,4 +194,689 @@
     return status ;
   }
+
+//   //scanNum_ = NSCAN + 1 ; // includes ZERO scan
+//   scanLen_ = SCNLEN ;
+//   dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;
+//   scanNum_ = getScanNum();
+//   rowNum_ = scanNum_ * ARYNM ;
+//   chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;
+//   record_->LDATA = new char[dataLen_] ;
+
+  initArray();
+
+  show() ;
+
+  return status ;
+}
+
+int NRODataset::fillHeaderCommon( int sameEndian ) 
+{
+  LogIO os( LogOrigin( "NRODataset", "fillHeader()", WHERE ) ) ;
+
+  int arymax = arrayMax() ;
+
+  string str4( 4, ' ' ) ;
+  string str8( 8, ' ' ) ;
+  string str16( 16, ' ' ) ;
+  string str18( 18, ' ' ) ;
+  string str24( 24, ' ' ) ;
+  string str40( 40, ' ' ) ;
+  string str120( 120, ' ' ) ;
+  char c4[4] ;
+  char c8[8] ;
+  char c16[16] ;
+  char c18[18] ;
+  char c24[24] ;
+  char c40[40] ;
+  char c120[120] ;
+
+  // make sure file pointer points a beginning of the file
+  fseek( fp_, 0, SEEK_SET ) ;
+
+  // read data header
+  strcpy( c8, str8.c_str() ) ;
+  if ( readHeader( c8, 8 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ;
+    return -1 ;
+  }
+  LOFIL = string( c8 ) ;
+  // DEBUG
+  //cout << "LOFIL = " << LOFIL << endl ;
+  //
+  strcpy( c8, str8.c_str() ) ;
+  if ( readHeader( c8, 8 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ;
+    return -1 ;
+  }
+  VER = string( c8 ) ;
+  // DEBUG
+  //cout << "VER = " << VER << endl ;
+  //
+  strcpy( c16, str16.c_str() ) ;
+  if ( readHeader( c16, 16 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ;
+    return -1 ;
+  }
+  GROUP = string( c16 ) ;
+  // DEBUG
+  //cout << "GROUP = " << GROUP << endl ;
+  //
+  strcpy( c16, str16.c_str() ) ;
+  if ( readHeader( c16, 16 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ;
+    return -1 ;
+  }
+  PROJ = string( c16 ) ;
+  // DEBUG
+  //cout << "PROJ = " << PROJ << endl ;
+  //
+  strcpy( c24, str24.c_str() ) ;
+  if ( readHeader( c24, 24 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ;
+    return -1 ;
+  }
+  SCHED = string( c24 ) ;
+  // DEBUG
+  //cout << "SCHED = " << SCHED << endl ;
+  //
+  strcpy( c40, str40.c_str() ) ;
+  if ( readHeader( c40, 40 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ;
+    return -1 ;
+  }  
+  OBSVR = string( c40 ) ;
+  // DEBUG
+  //cout << "OBSVR = " << OBSVR << endl ;
+  //
+  strcpy( c16, str16.c_str() ) ;
+  if ( readHeader( c16, 16 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ;
+    return -1 ;
+  }
+  LOSTM = string( c16 ) ;
+  // DEBUG
+  //cout << "LOSTM = " << LOSTM << endl ;
+  //
+  strcpy( c16, str16.c_str() ) ;
+  if ( readHeader( c16, 16 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ;
+    return -1 ;
+  }
+  LOETM = string( c16 ) ;
+  // DEBUG
+  //cout << "LOETM = " << LOETM << endl ;
+  //
+  if ( readHeader( ARYNM, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "ARYNM = " << ARYNM << endl ;
+  //
+  if ( readHeader( NSCAN, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "NSCAN = " << NSCAN << endl ;
+  //
+  strcpy( c120, str120.c_str() ) ;
+  if ( readHeader( c120, 120 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ;
+    return -1 ;
+  }
+  TITLE = string( c120 ) ;
+  // DEBUG
+  //cout << "TITLE = " << TITLE << endl ;
+  //
+  strcpy( c16, str16.c_str() ) ;
+  if ( readHeader( c16, 16 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ;
+    return -1 ;
+  }
+  OBJ = string( c16 ) ;
+  // DEBUG
+  //cout << "OBJ = " << OBJ << endl ;
+  //
+  strcpy( c8, str8.c_str() ) ;
+  if ( readHeader( c8, 8 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ;
+    return -1 ;
+  }
+  EPOCH = string( c8 ) ;
+  // DEBUG
+  //cout << "EPOCH = " << EPOCH << endl ;
+  //
+  if ( readHeader( RA0, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "RA0 = " << RA0 << endl ;
+  //
+  if ( readHeader( DEC0, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "DEC0 = " << DEC0 << endl ;
+  //
+  if ( readHeader( GLNG0, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "GLNG0 = " << GLNG0 << endl ;
+  //
+  if ( readHeader( GLAT0, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "GLAT0 = " << GLAT0 << endl ;
+  //
+  if ( readHeader( NCALB, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "NCALB = " << NCALB << endl ;
+  //
+  if ( readHeader( SCNCD, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SCNCD = " << SCNCD << endl ;
+  //
+  strcpy( c120, str120.c_str() ) ;
+  if ( readHeader( c120, 120 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ;
+    return -1 ;
+  }
+  SCMOD = string( c120 ) ;
+  // DEBUG
+  //cout << "SCMOD = " << SCMOD << endl ;
+  //
+  if ( readHeader( URVEL, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "URVEL = " << URVEL << endl ;
+  //
+  strcpy( c4, str4.c_str() ) ;
+  if ( readHeader( c4, 4 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ;
+    return -1 ;
+  }
+  VREF = string( c4 ) ;
+  // DEBUG
+  //cout << "VREF = " << VREF << endl ;
+  //
+  strcpy( c4, str4.c_str() ) ;
+  if ( readHeader( c4, 4 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ;
+    return -1 ;
+  }
+  VDEF = string( c4 ) ;
+  // DEBUG
+  //cout << "VDEF = " << VDEF << endl ;
+  //
+  strcpy( c8, str8.c_str() ) ;
+  if ( readHeader( c8, 8 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ;
+    return -1 ;
+  }
+  SWMOD = string( c8 ) + "::OTF" ;
+  // DEBUG
+  //cout << "SWMOD = " << SWMOD << endl ;
+  //
+  if ( readHeader( FRQSW, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "FRQSW = " << FRQSW << endl ;
+  //
+  if ( readHeader( DBEAM, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "DBEAM = " << DBEAM << endl ;
+  //
+  if ( readHeader( MLTOF, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "MLTOF = " << MLTOF << endl ;
+  //
+  if ( readHeader( CMTQ, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CMTQ = " << CMTQ << endl ;
+  //
+  if ( readHeader( CMTE, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CMTE = " << CMTE << endl ;
+  //
+  if ( readHeader( CMTSOM, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CMTSOM = " << CMTSOM << endl ;
+  //
+  if ( readHeader( CMTNODE, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CMTNODE = " << CMTNODE << endl ;
+  //
+  if ( readHeader( CMTI, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CMTI = " << CMTI << endl ;
+  //
+  strcpy( c24, str24.c_str() ) ;
+  if ( readHeader( c24, 24 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ;
+    return -1 ;
+  }
+  CMTTM = string( c24 ) ;
+  // DEBUG
+  //cout << "CMTTM = " << CMTTM << endl ;
+  //
+  if ( readHeader( SBDX, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SBDX = " << SBDX << endl ;
+  //
+  if ( readHeader( SBDY, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SBDY = " << SBDY << endl ;
+  //
+  if ( readHeader( SBDZ1, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SBDZ1 = " << SBDZ1 << endl ;
+  //
+  if ( readHeader( SBDZ2, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SBDZ2 = " << SBDZ2 << endl ;
+  //
+  if ( readHeader( DAZP, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "DAZP = " << DAZP << endl ;
+  //
+  if ( readHeader( DELP, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "DELP = " << DELP << endl ;
+  //
+  if ( readHeader( CHBIND, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CHBIND = " << CHBIND << endl ;
+  //
+  if ( readHeader( NUMCH, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "NUMCH = " << NUMCH << endl ;
+  //
+  if ( readHeader( CHMIN, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CHMIN = " << CHMIN << endl ;
+  //
+  if ( readHeader( CHMAX, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "CHMAX = " << CHMAX << endl ;
+  //
+  if ( readHeader( ALCTM, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "ALCTM = " << ALCTM << endl ;
+  //
+  if ( readHeader( IPTIM, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "IPTIM = " << IPTIM << endl ;
+  //
+  if ( readHeader( PA, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "PA = " << PA << endl ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    strcpy( c18, str18.c_str() ) ;
+    if ( readHeader( c18, 16 ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+    c18[16] = '\0' ;
+    RX[i] = string( c18 ) ;
+  }
+  // DEBUG
+//   nro_debug_output( "RX", arymax, RX ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    if ( readHeader( HPBW[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "HPBW", arymax, HPBW ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    if ( readHeader( EFFA[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "EFFA", arymax, EFFA ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    if ( readHeader( EFFB[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "EFFB", arymax, EFFB ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    if ( readHeader( EFFL[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "EFFL", arymax, EFFL ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++ ) {
+    if ( readHeader( EFSS[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "EFSS", arymax, EFSS ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( GAIN[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "GAIN", arymax, GAIN ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    strcpy( c4, str4.c_str() ) ;
+    if ( readHeader( c4, 4 ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+    HORN[i] = string( c4 ) ;
+  }
+  // DEBUG
+//   nro_debug_output( "HORN", arymax, HORN ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    strcpy( c4, str4.c_str() ) ;
+    if ( readHeader( c4, 4 ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+    POLTP[i] = string( c4 ) ;
+  }
+  // DEBUG
+//   nro_debug_output( "POLTP", arymax, POLTP ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( POLDR[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "POLDR", arymax, POLDR ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( POLAN[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "POLAN", arymax, POLAN ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "DFRQ", arymax, DFRQ ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    strcpy( c4, str4.c_str() ) ;
+    if ( readHeader( c4, 4 ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+    SIDBD[i] = string( c4 ) ;
+  }
+  // DEBUG
+//   nro_debug_output( "SIDBD", arymax, SIDBD ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( REFN[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "REFN", arymax, REFN ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( IPINT[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "IPINT", arymax, IPINT ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( MULTN[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "MULTN", arymax, MULTN ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "MLTSCF", arymax, MLTSCF ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    strcpy( c8, str8.c_str() ) ;
+    if ( readHeader( c8, 8 ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+    LAGWIND[i] = string( c8 ) ;
+  }
+  // DEBUG
+//   nro_debug_output( "LAGWIND", arymax, LAGWIND ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( BEBW[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "BEBW", arymax, BEBW ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( BERES[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "BERES", arymax, BERES ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( CHWID[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "CHWID", arymax, CHWID ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( ARRY[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "ARRY", arymax, ARRY ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "NFCAL", arymax, NFCAL ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {
+      os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ;
+      return -1 ;
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "F0CAL", arymax, F0CAL ) ;
+  //
+  for ( int i = 0 ; i < arymax ; i++) {
+    for ( int j = 0 ; j < 10 ; j++ ) {
+      if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {
+        os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ;
+        return -1 ;
+      }
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ;
+  //  
+  for ( int i = 0 ; i < arymax ; i++) {
+    for ( int j = 0 ; j < 10 ; j++ ) {
+      if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {
+        os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ;
+        return -1 ;
+      }
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ;
+  //  
+  for ( int i = 0 ; i < arymax ; i++) {
+    for ( int j = 0 ; j < 10 ; j++ ) {
+      if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {
+        os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ;
+        return -1 ;
+      }
+    }
+  }
+  // DEBUG
+//   nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ;
+  //  
+  if ( readHeader( SCNLEN, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SCNLEN = " << SCNLEN << endl ;
+  //
+  if ( readHeader( SBIND, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "SBIND = " << SBIND << endl ;
+  //
+  if ( readHeader( IBIT, sameEndian ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ;
+    return -1 ;
+  }
+  // DEBUG
+  //cout << "IBIT = " << IBIT << endl ;
+  //
+  strcpy( c8, str8.c_str() ) ;
+  if ( readHeader( c8, 8 ) == -1 ) {
+    os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ;
+    return -1 ;
+  }
+  SITE = string( c8 ) ;
+  // DEBUG
+  //cout << "SITE = " << SITE << endl ;
+  //
 
   //scanNum_ = NSCAN + 1 ; // includes ZERO scan
@@ -202,9 +888,5 @@
   record_->LDATA = new char[dataLen_] ;
 
-  initArray();
-
-  show() ;
-
-  return status ;
+  return 0 ;
 }
 
