Location: PHPKode > scripts > Legacy Files > legacy-files/dem2.php
<?

require('LegacyFiles.php');

$Legacy = new LegacyFiles("TDDG0603.TXT","DDTALGEN");
$Legacy->DefineHeaderFormat(
  array(
    array('DUM1' ,'A',  8,0),
    array('YYY'  ,'Y',  8,0),
    array('DUM2' ,'A',  6,0),
    array('DATE' ,'N',  6,0),
    array('DUM3' ,'A',  1,0),
    array('NNN'  ,'N',  6,0),
    array('DUM4' ,'A',154,0)
  )
);
$Legacy->DefineFooterFormat(
  array(
    array('DUM1' ,'A',  8,0),
    array('YYY'  ,'Y',  8,0),
    array('DUM2' ,'A',  6,0),
    array('DATE' ,'N',  6,0),
    array('DUM3' ,'A',  1,0),
    array('NNN'  ,'N',  6,0),
    array('DUM4' ,'A',154,0)
  )
);
$Legacy->DefineFieldsFormat(
  array(
    array('CORP'       ,'N', 4,0),
    array('STORE'      ,'N', 4,0),
    array('DEVID'      ,'N',11,0),
    array('PCK'        ,'N', 3,0),
    array('CHARGE'     ,'N', 6,0),
    array('VALUE'      ,'N', 9,2),
    array('PROVID'     ,'N', 6,0),
    array('PROVNAME'   ,'A',40,0),
    array('STREET'     ,'A',45,0),
    array('DISTRICT'   ,'A',40,0),
    array('CITYID'     ,'N', 4,0),
    array('ZIP'        ,'A', 6,0)
  )
);

$Legacy->ReadFile();

print_r($Legacy->_errors);
echo $Legacy->HeaderFields("DATE")."\n";
while(!$Legacy->EOF()) {
  echo $Legacy->RecordFields("DEVID")."\n";
  $Legacy->GoNext();
}
echo $Legacy->FooterFields("NNN")."\n";

?>
Return current item: Legacy Files