Paymentech file comparison in Linux
- Here Is A Sample Unix / Linux Script That Checks The Payment Settlement File And Acknowledgement File
- What does this means if [ $# -ne 3 ] in Linux / Unix?
- What does this ( if [$? -ne 0] ) mean in unix ? Linux
- Bash Script: How Do I Copy The Missing Files, Directories Alone From a Directory to Another Directory in Linux?
- Oracle applications (11i) Invalid credit cards in bank records report
This shows the power of Linux shell script to compare the contents of the file. Paymentech credit card/debit card processor gets the settlement file, and acknowledges the settlement file after processing the file. The return file or acknowledgment file contains the same records with additional remarks (normally “Y”) of acknowledgment. On some days, the acknowledgment fails. In such case, this script finds the files which are not acknowledged at any given time. At the end, it sends an email listing the not acknowledged file details.
Assumption: Both forward and return files are located at the same directory (here /tmp/batch)
Feel free to copy and modify as per your requirement.
#
# Developed by Jiltin
# Paymentech files Not acknowledged
#
FILENAME="Missing_FTP_Files.txt"
if [ -f $FILENAME ]
then
rm -rf $FILENAME
echo "Old Data File ($FILENAME) deleted…"
fi
SRCDIR="/tmp/batch"
FTITLE="Missing ftp files dated `date`"
echo ${FTITLE} ‘ tee -a ${FILENAME}
#
#
SRCLIST=`ls -C1 ${SRCDIR} ‘ grep -v backup ‘ grep -v done`
for ARG in $SRCLIST
do
#echo "${SRCDIR}/${ARG}"
VAR=`grep -i "^S" "${SRCDIR}/${ARG}" ‘ head -1 ‘ cut -b1-20`
#echo $VAR
#VAR=`cut -b1-20 "${SRCDIR}/${ARG}" ‘ head -2 ‘ tail -1 `
#echo "grep -i ${VAR} ${SRCDIR}/*done"
RES=`grep -i ${VAR} ${SRCDIR}/*done`
#echo "${RES}"
if [ -z "${RES}" ]; then
echo "`ls -ltr ${SRCDIR}/${ARG}` `tail -2 ${SRCDIR}/${ARG} ‘ head -1 ‘ cut -b59-72`" ‘ tee -a ${FILENAME}
fi
done
if [ -f $FILENAME ]
then
FILESIZE=$(stat -c%s "$FILENAME")
if [ $FILESIZE -gt 52 ]
then
uuencode $FILENAME $FILENAME ‘ mail -s "${FTITLE}" "admin@notesbit.com"
fi
fi

Comments
No comments yet.