Script writing for tables with binary data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script writing for tables with binary data
# 1  
Old 01-19-2018
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?


Code:
/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:

Code:
/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

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 01-19-2018 at 07:39 PM.. Reason: Added CODE tags.
# 2  
Old 01-19-2018
try using "strings" and/or "dos2ux" instead of "cat" to pipe file into mail command
This User Gave Thanks to rdrtx1 For This Post:
# 3  
Old 01-20-2018
Attach the binary file using the -a option.
Code:
       -a file
              Attach the given file to the message.

This User Gave Thanks to frank_rizzo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using bash script : How to Import data from a dsv file into multiple tables in mysql

HI I have a dsv file that looks like: <<BOF>> record_number|id_number|first name|last name|msisdn|network|points|card number|gender 312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M 313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
Discussion started by: tera
4 Replies

2. Programming

Writing a file in Binary

Hello All, I need to read values from database and then need to write to a file. Planning to do that as binary since no one can modify the values. We tried to write the file in "B" mode and the file is created but when I try to open in notepad I am able to do. I there a way that someone should... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

3. Programming

writing binary file (C++)

Hi guys, I am writing a vector into a binary file (linux of course), but somehow there seems to be something wrong with this code, because the output file size in binary is BIGGER than doing it with the same vector but insead of binary, in plain text, and I as far as I understand, binary files size... (8 Replies)
Discussion started by: lamachejo
8 Replies

4. Shell Programming and Scripting

Shell script for comparing data of tables

Hi, I have two databases with same tables on different servers.I need to check the data content in each table and if something is missing, should print that. I have a tool which takes the snapshot the table structure,index so on and compares with the other server tables snapshot. Now i need... (1 Reply)
Discussion started by: nessj
1 Replies

5. Programming

writing binary/struct data to file

I am trying to write binary data to a file. My program below: #include <stdlib.h> #include <stdio.h> struct tinner { int j; int k; }; struct touter { int i; struct tinner *inner; }; int main() { struct touter data; data.i = 10; struct tinner... (4 Replies)
Discussion started by: radiatejava
4 Replies

6. Shell Programming and Scripting

script or piece of code where the data returned by a stored procedure you are writing

hi fndz. Can you please help me with the code if I call a stored procedure from my shell script and stored procedure returns a cursor, cursor output should be saved to a file (3 Replies)
Discussion started by: enigma_83
3 Replies

7. Shell Programming and Scripting

help for a perl script - writing to a data file

Hi, Here is my problem.. i have 2 files (file1, file2).. i have wrote the last two lines and first 4 lines of "file2" into two different variables .. say.. my $firstrec = `head -4 $file2`; my $lastrec = `tail -2 $file2`; and i write the rest of the file2 to a tmpfile and cat it with head... (2 Replies)
Discussion started by: meghana
2 Replies

8. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

9. Shell Programming and Scripting

help for writing shell script to export table data

Hi All, I need to write a shell script(ksh) to take the tables backup in oracle(exporting tables data). The tables list is not static, and those are selecting through dynamic sql query. Can any body help how to write this shell script. Thanks, (3 Replies)
Discussion started by: sankarg
3 Replies

10. UNIX for Advanced & Expert Users

writing database tables into a file in unix

I want to collect the database tables(Ex: Emp,Sal,Bonus...etc) in a file & give this file at the command prompt, when prompted for the tables list at command prompt. How can i do that ? Ex:- Import jason/jason1 tables=emp,sal,bonus log=j1.log i want to change this into Ex:- Import... (3 Replies)
Discussion started by: dreams5617
3 Replies
Login or Register to Ask a Question