Script writing for tables with binary data

Hi There,

I'm trying to write a simple script that will email me when we have an application job in a certain status that needs human intervention. I've used this script for other tables and it works great. However, this one gives me the warning that there is binary data so it might not. It doesn't work. I get an email for an empty file and not the email that I should get.

Here is my script and the warning I get when I run it. Is there a way to run a script with binary data? Or write it to a file that converts the binary data?

/home/lawson/scripts/> pg jobcheck.ksh
#!/usr/bin/ksh
# Script Name: jobcheck.ksh
# 09/12/2016 - created by Leslie Cole
#===========================================================#
# Check for jobs in Needs Recovery and Invalid Parms        #
#===========================================================#
 . /usr/bin/cv
HOST=$(hostname)
set -x
 #checking for Invalid Parms Jobs
rngdbdump gen queuedjob -v status=35 > JobsInvalid.dump
 #checking for NeedsRecovery Jobs
rngdbdump gen queuedjob -v status=34 > NeedsRecovery.dump
 
grep 35 JobsInvalid.dump
if [ $? -ne 0 ]
then
    cat JobsInvalid.dump |mail -s "ALERT:  Lawson Jobs with Invalid Params on $HOST" leslie.cole@xxx.com
 fi
grep 34 NeedsRecovery.dump
if [ $? -ne 0 ]
then
      cat NeedsRecovery.dump |mail -s "ALERT:  Lawson Jobs in Needs Recovery on $HOST" leslie.cole@xxx.com
fi

Warning when I run my script:

/home/lawson/scripts/> ./jobcheck.ksh
+ rngdbdump gen queuedjob -v status=35
+ 1> JobsInvalid.dump
WARNING: File 'queuedjob' contains BINARY fields.
Dumping/Loading in non-dbdump/dbload format may produce unreliable results.
+ rngdbdump gen queuedjob -v status=34
+ 1> NeedsRecovery.dump
WARNING: File 'queuedjob' contains BINARY fields.
Dumping/Loading in non-dbdump/dbload format may produce unreliable results.
+ grep 35 JobsInvalid.dump
0000006265 ilm6b      AR220.2    ********** 35        0           0        0
0000006270 ilm6b      AR220.4    ********** 35        0           1        0
0000006316 iln5m      MONTHCASH  ********** 35        0           2        0
                    12/01/2017 09:35:37 12/01/2017 09:35:38 PROD
0000008908 10028645   GL292      ********** 35        0           3        0
+ [ 0 -ne 0 ]
+ grep 34 NeedsRecovery.dump
+ [ 1 -ne 0 ]
+ cat NeedsRecovery.dump
+ mail -s ALERT:  Lawson Jobs in Needs Recovery on usdenupvcalawapp leslie.cole@xxx.com

Any thoughts? Thanks in advance for the help!
Leslie

try using " strings " and/or " dos2ux " instead of " cat " to pipe file into mail command

1 Like

Attach the binary file using the -a option.

       -a file
              Attach the given file to the message.
1 Like