Hi all,
We are going through a total migration from AIX-based server framework to Linux-based servers. When I am testing *.sh and *.awk in a lower environments, it abends at the same step everytime in verifying the record length of the first row of the source file.
I know this source file is good because I pulled the file from the production environment in which the source file was already processed succesfully. So, I'm thinking the existing script (a header checking process) that was pulled from the existing AIX production server. There are two result options for this script: Good or Problem File.
The error always comes back that there is a "Problem with the source file sent". I'm not a scripter as it's not part of my duties, but the task has fallen onto my team. Wondering if the script below is compatible with Linux server syntax?? ANY insight would be greatly appreciated.
BEGIN {
good_count = 0
bad_count = 0
line_count = 0
}
NR == 1 {
rec_count = substr($0, 15, 8)
date_str = substr($0, 32, 10)
print "Date in Header Record : " date_str
}
NR > 1 {
line_count++
if (length($0) == 710)
{
print $0 > GoodFile
good_count++
}
else
{
print $0 > BadFile
bad_count++
}
}
END {
if ( line_count == rec_count && bad_count==0 )
{
print "********************************************"
print "Count in header : " rec_count
print "Count in file received : " line_count
print " "
print "Number of Good Records : " good_count
print "Number of Bad Records : " bad_count
}
else
{
print "********************************************"
print " PROBLEM WITH FILE SENT FROM SOURCE "
print " "
print "Count in header : " rec_count
print "Count in file received : " line_count
print " "
print "Number of Good Records : " good_count
print "Number of Bad Records : " bad_count
exit 99
}
}