Login   Register  
PHP Classes
elePHPant
Icontem

File: dem2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mario Haza  >  Legacy Files  >  dem2.php  >  Download  
File: dem2.php
Role: Example script
Content type: text/plain
Description: demo
Class: Legacy Files
Manipulate legacy text files on various formats
Author: By
Last change:
Date: 9 years ago
Size: 1,286 bytes
 

Contents

Class file image Download
<?

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";

?>