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
CAT(1)									FSF								    CAT(1)

NAME
cat - concatenate files and print on the standard output SYNOPSIS
cat [OPTION] [FILE]... DESCRIPTION
Concatenate FILE(s), or standard input, to standard output. -A, --show-all equivalent to -vET -b, --number-nonblank number nonblank output lines -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank never more than one single blank line -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exit With no FILE, or when FILE is -, read standard input. AUTHOR
Written by Torbjorn Granlund and Richard M. Stallman. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for cat is maintained as a Texinfo manual. If the info and cat programs are properly installed at your site, the command info cat should give you access to the complete manual. cat (coreutils) 4.5.3 February 2003 CAT(1)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy