The following is the current code:
PROCESS_NAME= EXTRACT (returned by the database)
EXTRACT_NAME=EXTRACT
DATA_FILE_NAME=test.dat
SUMMARY_FILE_NAME=test.sum
if [ "$PROCESS_NAME" = "$EXTRACT_NAME" ];
then echo "String vals for $PROCESS_NAME and $EXTRACT_NAME are ="
CountA=`wc -l $DATA_FILE_NAME | awk '{print $1}'`
echo $CountA
CountB=`awk 'NR==1 {print $2;next}' $SUMMARY_FILE_NAME`
echo $CountB
if [ $CountA -eq $CountB ];
then
echo "Ok"
Process will write an SUCCESS record to the database
Else
Echo “Count Don’t Match”
Process will write an ERROR record to the database
The above works fine
The question is:
I need to check the following two conditions:
IF "$PROCESS_NAME" = "$EXTRACT_NAME" and
the $DATA_FILE_NAME and $SUMMARY_FILE_NAME files (always two files) have not arrived
the process should write “ERROR” to the database
IF "$PROCESS_NAME" = "$EXTRACT_NAME" and
the $DATA_FILE_NAME and $SUMMARY_FILE_NAME files have arrived
AND the counts match, the process will write a “SUCCESS” record in the database. (above code should work)
AND the counts don’t match, the process will write an “ERROR” record in the database. (above code should work)
Any help is appreciated