rm PRC/*
awk -F"^" ' 
{ dt=$2 }
{ file = "PRC/H"sprintf("%.4d",NR) }
$2=="PROCESO" {
print "H01"$1 > file
print "H02"$3 > file
print "H0303" > file
print "H04AFECTA COSTO\r"$4 > file
print "H0500" > file
print " " >file
close(file)
} ' PROCU
>../data/proce/H
>../data/proce/HEAD
echo -n "    0     0">../data/proce/INFO
echo

for i in PRC/*
do
../ihd/bin/ihmu proce ../../import/$i -N1
done
rm PRC/*
awk -F"^" ' 
{ dt=$2 }
{ file = "PRC/H"sprintf("%.4d",NR) }
$2=="BASE" {
print "H01"$1 > file
print "H02"$3 > file
print "H0303" > file
print "H04AFECTA COSTO\r"$4 > file
print "H0500" > file
print " " >file
close(file)
} ' PROCU
>../data/bases/H
>../data/bases/HEAD
echo -n "    0     0">../data/bases/INFO

echo
for i in PRC/*
do
../ihd/bin/ihmu bases ../../import/$i -N1
done

rm PRC/*
awk -F"^" ' 
{ dt=$2 }
{ file = "PRC/H"sprintf("%.4d",NR) }
$2=="GRAFICO" {
print "H01"$1 > file
print "H02"$3 > file
print "H0303" > file
print "H04AFECTA COSTO\r"$4 > file
print "H0500" > file
print " " >file
} ' PROCU
>../data/grafi/H
>../data/grafi/HEAD
echo -n "    0     0">../data/grafi/INFO

echo
for i in PRC/*
do
../ihd/bin/ihmu grafi ../../import/$i -N1
done
exit

