Sponsored Content
Full Discussion: BCP with cat not working
Top Forums UNIX for Dummies Questions & Answers BCP with cat not working Post 302948631 by arunkumar_mca on Wednesday 1st of July 2015 04:44:56 AM
Old 07-01-2015
Here is the lines of code

Code:
bcp_in() {
#echo  -e "\n\n\t\tbcp in $_currdate"

  echo -e 
  echo -e "BCP: $_currdate input file information into logfile table...\n"

  cat <<-endOfCat | bcp ${_DBName}..logfile in ${_currdate} -f$P/format/logfile.fmt -Q  -U$_UserId -P$_Password
  endOfCat

  if [ $? -ne 0 ]
  then
    echo -e "\n\n\t\tError in BCP. Verify the command"
   # delete_tables       
   # abort_message
  fi
}


bcp_out() {
#echo  -e "\n\n\t\tbcp out for file $_currdate"

echo -e "\n\n\t\tbcp out for file $_errfile"
}

#main

#Check for minumum number of arguments 
#
if [ $# -ne 4 ]
then
  print_version
  echo -e "\nUsage:" ${PROG}" THIS JOB IS TO BE RUN AS AUTOSYS JOB.PLEASE READ THE JOB DOCUMENT  \n"
  exit 1
fi
# Move the parameters into variables
_DBName=$1
_UserId=$2
_javadebug=`echo -e $JAVA_DEBUG`
export JAVA_DEBUG=0
_EncryptedPassword=$3
_Password=`$P_HOME/bin/jrun.ksh`
export JAVA_DEBUG=_javadebug
_indicator=$4
_ProcessId=$$


if [ $_indicator -eq 1 ]
then    
   _day1="$(date '+%a')"
   _day2="Tue"

   if [ $_day1 == $_day2 ]
   then
      echo "processing the file for 2 days before"
      _prev2date="log$(date -d "2 days ago" +"%y%j")"
      

      _currdate=$P/receiver/$_prev2date
      _logfile_name=$_prev2date
      _errfile=$PANEL_OUTPUTFILE_PATH/$_prev2date"_err"
     
_vercor_prev2date="vercor_$(date -d "2 days ago" +"%y%j")_001.txt"
      _ver_prev2date="ver_$(date -d "2 days ago" +"%y%j")_001.txt"
      
      _vercor_currdate=$P/receiver/$_vercor_prev2date
      _ver_currdate=$P/receiver/$_ver_prev2date

     # process_ver_file 
      process_input_file

      echo  "processing the file for previous_day"
      _prev1date="log$(date -d "yesterday" +"%y%j")"
      _currdate=$P/receiver/$_prev1date
      _logfile_name=$_prev1date
      _errfile=$PANEL_OUTPUTFILE_PATH/$_prev1date"_err"
      
      _vercor_prev1date="vercor_$(date -d "yesterday" +"%y%j")_001.txt"
      _ver_prev1date="ver_$(date -d "yesterday" +"%y%j")_001.txt"
            
      _vercor_currdate=$P/receiver/$_vercor_prev1date
      _ver_currdate=$P/receiver/$_ver_prev1date
      
      #process_ver_file
      process_input_file

      echo "processing the file for current_day"
     _currdate=$P/receiver/"log$(date '+%y%j')"
     _logfile_name="log$(date '+%y%j')"
     _errfile=$PANEL_OUTPUTFILE_PATH/"log$(date '+%y%j')_err"

     _vercor_currdate=$P/receiver/"vercor_$(date '+%y%j')_001.txt"
     _ver_currdate=$P/receiver/"ver_$(date '+%y%j')_001.txt"

#      process_ver_file
      process_input_file
   else
     echo processing the file for current_day
     _currdate=$P/receiver/"log$(date '+%y%j')"
     _errfile=$PANEL_OUTPUTFILE_PATH/"log$(date '+%y%j')_err"

     _vercor_currdate=$P/receiver/"vercor_$(date '+%y%j')_001.txt"
      _ver_currdate=$P/receiver/"ver_$(date '+%y%j')_001.txt"


     process_input_file
   fi

else
     echo processing the file for current_day
     _currdate=$P/receiver/"log$(date '+%y%j')"
     _errfile=$PANEL_OUTPUTFILE_PATH/"log$(date '+%y%j')_err"

     _vercor_currdate=$P/receiver/"vercor_$(date '+%y%j')_001.txt"
      _ver_currdate=$P/receiver/"ver_$(date '+%y%j')_001.txt"


     process_input_file
fi

# Display the success message
success_message

exit 0

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

2. UNIX for Advanced & Expert Users

cat and grep not working

I am trying to cat a file and then grep that file for a number. I can do it fine on other files but this particular file will not do anything. I tried running it on an older file from the same device but it is just not working. The file is nothing more than a flat file on a unix box. Here is just a... (3 Replies)
Discussion started by: jphess
3 Replies

3. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

4. OS X (Apple)

Cat command not working as expected

I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction. I'm... (10 Replies)
Discussion started by: Daniel M. Clark
10 Replies

5. Shell Programming and Scripting

BCP command or module

Hi All, I am trying to bcp in data file into database. now there is bcp command available in unix and another perl module Sybase::BCP is also available. Can anyone please let me know if there is any limitations of bcp command in unix. whichever is good to use? (1 Reply)
Discussion started by: Deei
1 Replies

6. Shell Programming and Scripting

sybase::bcp

I am trying to bcp in using sybase::bcp perl module. I can find we can give user, pwd and server name in the parameters. How can I give database and table name? (1 Reply)
Discussion started by: Deei
1 Replies

7. Shell Programming and Scripting

bcp command help

Hi, When i execute a script in unix, the result i got is :: ./purgeErrors.ksh: bcp: not found What is the meaning of that output ? --- Aditya (9 Replies)
Discussion started by: chaditya
9 Replies

8. Shell Programming and Scripting

bcp error

hi all, Getting error while working on sybase::bcp as below, DB-Library error: Attempt to convert data stopped by syntax error in source field. Code is like, my $bcp_files = new Sybase::BCP $usr, $pass, $server; ---------- Post updated at 02:05 AM ---------- Previous update... (0 Replies)
Discussion started by: Deei
0 Replies

9. Shell Programming and Scripting

Cat command not working to display Mac file in Ubuntu

Hi, Recently I got a .txt file from Mac user. when I try to open it in my Ubuntu machine using cat command it is not displaying any content of file however I can see the content using vi. Anyone know How to see its content using cat as I have to process it in my shell script. Thanks in... (4 Replies)
Discussion started by: diehard
4 Replies
diff3(1)							   User Commands							  diff3(1)

NAME
diff3 - 3-way differential file comparison SYNOPSIS
diff3 [-exEX3] filename1 filename2 filename3 DESCRIPTION
diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes: ==== all three files differ ====1 filename1 is different ====2 filename2 is different ====3 filename3 is different The type of change suffered in converting a given range of a given file to some other is indicated in one of these ways: f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3. f : n1 , n2 c Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1. The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of the lower-numbered file is suppressed. The following command will apply the resulting script to filename1. (cat script; echo '1,$p') | ed - filename1 OPTIONS
-e Produce a script for the ed(1) editor that will incorporate into filename1 all changes between filename2 and filename3 (that is, the changes that normally would be flagged ==== and ====3). -x Produce a script to incorporate only changes flagged ====. -3 Produce a script to incorporate only changes flagged ====3. -E Produce a script that will incorporate all changes between filename2 and filename3, but treat overlapping changes (that is, changes that would be flagged with ==== in the normal listing) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by <<<<<< and >>>>>> lines. -X Produce a script that will incorporate only changes flagged ====, but treat these changes in the manner of the -E option. USAGE
See largefile(5) for the description of the behavior of diff3 when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). FILES
/tmp/d3* /usr/lib/diff3prog ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Availability |SUNWesu | |CSI |enabled | +-----------------------------+-----------------------------+ SEE ALSO
diff(1), attributes(5), largefile(5) NOTES
Text lines that consist of a single `.' will defeat -e. Files longer than 64 Kbytes will not work. SunOS 5.10 14 Sep 1992 diff3(1)
All times are GMT -4. The time now is 06:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy