In the following Korn shell script, I am attempting to get a count all of the rows from a db2 table in which the PROCESS_DT is equal to yesterday's UNIX system date. The script runs without error, but returns a count of 0 when I am 100% certain that there are over 3 millions records with a PROCESS_DT equal to yesterday's date. Does any one have any suggestions?
#!/usr/bin/ksh
DATE_STAMP=`TZ=CST+24 date +%Y-%m-%d`
RecCount='db2 -x "select count(*) from schema.tablename where PROCESS_DT=DATE("$DATE_STAMP")`
echo "$RecCount"
echo "$DATE_STAMP"