Sponsored Content
Top Forums Shell Programming and Scripting Script not reading Data from oracle table properly Post 302303588 by Sagarddd on Friday 3rd of April 2009 03:36:52 AM
Old 04-03-2009
#!/usr/bin/ksh
PROG=`basename ${0}`
SHL_DIR=`dirname ${0}`
EXIT_STATUS=0
ParameterFile="CbsCollPay_static.ini"
#
# BINPATH="/opt/app/dstage/Ascential/DataStage/DSEngine/bin"
BINPATH=${DS_HOME}/bin
#
RUNSCRIPTPATH="/EVF/work_08/script/"
#
# ORACLE_HOME="/etl01/opt/app/oracle/product/8.1.7/"
# export ORACLE_HOME
# ORAPATH="/etl01/opt/app/oracle/product/8.1.7/bin"
RUNBATCHNAME="Batch::CBSCollPayMaster"
PROJDIR="/EVF/work_08/"
BATCHNAME="LP/COLLPAY/CBS"
INIDIR="ini"
LOGDIR="/EVF/work_08/LP/COLLPAY/CBS/log" #CHANGE#
X=0
BATCHTIMESTAMP=`date +"%Y-%m-%d-%H.%M.%S"`
echo "${BATCHTIMESTAMP} ${PROG} Initialization..."
LOGFILE="${LOGDIR}/CbsCollPay_${BATCHTIMESTAMP}.log" #CHANGE#
if [ ! -r ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} ]; then
error_ msg="${BATCHTIMESTAMP} ${PROG} Failed to read parameter file ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile}"
break
fi
set -x
# Look in the parameters.ini file to determine the directory paths
ICVDB=`grep "ICVDB=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ICVDBUSER=`grep "ICVDBUSER=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ICVDBPASSWORD=`grep "ICVDBPASSWORD=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile}|cut -d "=" -f2`
SRCDIR=`grep "SRCDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
PROJDIR=`grep "PROJDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
SCRIPTDIR=`grep "SCRIPTDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ARCHDIR=`grep "ARCHDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPSERVERNAME=`grep "FTPSERVERNAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPUSERNAME=`grep "FTPUSERNAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPPASSWORD=`grep "FTPPASSWORD=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
REMOTEDIR=`grep "REMOTEDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
SRCFILENAME=`grep "SRCFILENAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
PREFILE=`ls ${PROJDIR}${BATCHNAME}/${ARCHDIR}/`
cd ${PROJDIR}${BATCHNAME}/${SRCDIR}/
chmod 775 *.*
if [ ! -f ${PROJDIR}${BATCHNAME}/${SRCDIR}/${PREFILE} ]; then
mv ${PROJDIR}${BATCHNAME}/${SRCDIR}/${PREFILE} ${PROJDIR}${BATCHNAME}/${ARCHDIR}/
fi
EXIT_STATUS=0
echo "ICVDB=$ICVDB" >> ${LOGFILE}
echo "ICVDBUSER=$ICVDBUSER" >> ${LOGFILE}
echo "ICVDBPASSWORD=$ICVDBPASSWORD" >> ${LOGFILE}
#
# /etl01/opt/app/oracle/product/8.1.7/bin/sqlplus ... ... #
#
X=`${ORACLE_HOME}/bin/sqlplus -silent $ICVDBUSER/$ICVDBPASSWORD@$ICVDB <<END
set pagesize 0 feedback off verify off heading off echo off
select cast((substr(max(a.LAST_FILE_NAME),10,LENGTH(max(Trim(a.LAST_FILE_NAME)))-13)) as integer) from DA.ETL_CONTROL
a where a.LAST_POST_DTS in(
select max(b.LAST_POST_DTS) from DA.ETL_CONTROL b where b.TABLE_NAME='CBS_COLL_PAYMENT');
EXIT;
END`



I am expecting Value of X.....
Some times its comming some times its not comming....
ID password values are geting passed coreectly


 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a table in a shell script

Dear all: I want to write a script capable of reading specific rows and collumns of a table, into a variable. Just imagine i have a file named table.dat which contains: GENERAL INFORMATION Col 1 Col2 Col3 1 1 2 2 3 3 4 4 What i want to do... (13 Replies)
Discussion started by: luiscarvalheiro
13 Replies

2. Shell Programming and Scripting

To load data from variable to oracle table

Hi all, How to load variable value into Oracle table? I have created a file validation shell script. After the validation completes, i need to update a Oracle table with the variable value... Can someone help me how to do it? I have searched, but not able to get answer. i have 4... (1 Reply)
Discussion started by: Amit.Sagpariya
1 Replies

3. Shell Programming and Scripting

To load data from variable to oracle table ....???

Hi all, How to load variable value into Oracle table? I have created a file validation shell script. After the validation completes, i need to update a Oracle table with the variable value... Can someone help me how to do it? I have searched, but not able to get answer. i have 4 variables... (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

4. Shell Programming and Scripting

load a data from text file into a oracle table

Hi all, I have a data like, 0,R001,2,D this wants to be loaded into a oracle database table. Pl let me know how this has to be done. Thanks in advance (2 Replies)
Discussion started by: raji35
2 Replies

5. Shell Programming and Scripting

Reading data from multiple tables from Oracle DB

Hi , I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code : X=`sqlplus -s user/pwd@DB <<eof select col1 from table1; EXIT; eof` echo $X>myfile Can anyone... (2 Replies)
Discussion started by: net
2 Replies

6. Shell Programming and Scripting

select data from oracle table and save the output as csv file

Hi I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data. I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Discussion started by: rdhanek
2 Replies

7. Shell Programming and Scripting

sending mail using Mailx with data from oracle table

Hi, i need to send emails to the mail ids i receive using the sql query . SELECT L.ALARM_DEF,L.CRITERIA,L.DISTANCE_METRE,L.EMAIL,L.LAC_ID,L.LAST_CHECK,L.RANGE, L.RESOURCE_MSISDN,LM.ADDRESS,LM.NAME FROM LANDMARK_ALARM_CONF l, LANDMARK lm WHERE L.LANDMARK_ID=LM.LANDMARK_ID AND... (0 Replies)
Discussion started by: aemunathan
0 Replies

8. Shell Programming and Scripting

Shell script to export data from Oracle table .

Hi, I want to write a shell script which will export data from oracle table . I don't want to save that data . I want the queries . Right now i am right clicking on the table and clicking on export as to my desktop . Please let me know if any one have any idea . (2 Replies)
Discussion started by: honey26
2 Replies

9. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

10. Shell Programming and Scripting

Run the Script from any stage by updating data from Oracle Table.

I have 100 Scripts, each containing 10-15 SQL's in them. Each Script run for 40 mins to 1 hour 30 mins. In the event of Failure in any step, if i re-start the Script, it will start running from the beginning. Which is waste of time. So in order handle this, i made the script to run from the... (7 Replies)
Discussion started by: kiran1992
7 Replies
prototype(4)							   File Formats 						      prototype(4)

NAME
prototype - package information file DESCRIPTION
prototype is an ASCII file used to specify package information. Each entry in the file describes a single deliverable object. An object may be a data file, directory, source file, executable object, and so forth. This file is generated by the package developer. Entries in a prototype file consist of several fields of information separated by white space. Comment lines begin with a ``#'' and are ignored. The fields are described below and must appear in the order shown. part An optional field designating the part number in which the object resides. A part is a collection of files and is the atomic unit by which a package is processed. A developer can choose criteria for grouping files into a part (for example, based on class). If this field is not used, part 1 is assumed. ftype A one-character field that indicates the file type. Valid values are: b block special device c character special device d directory e a file to be edited upon installation or removal (may be shared by several packages) f a standard executable or data file i installation script or information file l linked file p named pipe s symbolic link v volatile file (one whose contents are expected to change, like a log file) x an exclusive directory accessible only by this package class The installation class to which the file belongs. This name must contain only alphanumeric characters and be no longer than 12 characters. The field is not specified for installation scripts. (admin and all classes beginning with capital letters are reserved class names.) pathname The pathname where the file will reside on the target machine, for example, /usr/bin/mail or bin/ras/proc. Relative path- names (those that do not begin with a slash) indicate that the file is relocatable. The form path1=path2 may be used for two purposes: to define a link and to define local pathnames. For linked files, path1 indicates the destination of the link and path2 indicates the source file. (This format is manda- tory for linked files.) For local pathnames, path1 indicates the pathname an object should have on the machine where the entry is to be installed and path2 indicates either a relative or fixed pathname to a file on the host machine which contains the actual contents. A pathname may contain a variable specification of the form $variable. If variable begins with a lower case letter, it is a build variable. If variable begins with an upper case letter, it is an install variable. Build variables are bound at build time. If an install variable is known at build time, its definition is inserted into the pkginfo(4) file so that it will be available at install time. If an install variable is not known at build time, it will be bound at install time. major The major device number. The field is only specified for block or character special devices. minor The minor device number. The field is only specified for block or character special devices. mode The octal mode of the file (for example, 0664). A question mark (?) indicates that the mode will be left unchanged, imply- ing that the file already exists on the target machine. This field is not used for linked files or packaging information files. The mode can be a variable specification of the form $variable. If variable begins with a lower case letter, it is a build variable. If variable begins with an upper case letter, it is an install variable. Build variables are bound at build time. If an install variable is known at build time, its definition is inserted into the pkginfo(4) file so that it will be available at install time. If an install variable is not known at build time, it will be bound at install time. owner The owner of the file (for example, bin or root). The field is limited to 14 characters in length. A question mark (?) indicates that the owner will be left unchanged, implying that the file already exists on the target machine. This field is not used for linked files or packaging information files. The owner can be a variable specification of the form $variable. If variable begins with a lower case letter, it is a build variable. If variable begins with an upper case letter, it is an install variable. Build variables are bound at build time. If an install variable is known at build time, its definition is inserted into the pkginfo(4) file so that it will be available at install time. If an install variable is not known at build time, it will be bound at install time. group The group to which the file belongs (for example, bin or sys). The field is limited to 14 characters in length. A question mark (?) indicates that the group will be left unchanged, implying that the file already exists on the target machine. This field is not used for linked files or packaging information files. The group can be a variable specification of the form $variable. If variable begins with a lower case letter, it is a build variable. If variable begins with an upper case letter, it is an install variable. Build variables are bound at build time. If an install variable is known at build time, its definition is inserted into the pkginfo(4) file so that it will be available at install time. If an install variable is not known at build time, it will be bound at install time. An exclamation point (!) at the beginning of a line indicates that the line contains a command. These commands are used to incorporate files in other directories, to locate objects on a host machine, and to set permanent defaults. The following commands are available: search Specifies a list of directories (separated by white space) to search for when looking for file contents on the host machine. The base name of the path field is appended to each directory in the ordered list until the file is located. Searches are not recursive. include Specifies a pathname which points to another prototype file to include. Note that search requests do not span include files. default Specifies a list of attributes (mode, owner, and group) to be used by default if attribute information is not provided for prototype entries which require the information. The defaults do not apply to entries in include prototype files. param=value Places the indicated parameter in the current environment. Spans to subsequent included prototype files. The above commands may have variable substitutions embedded within them, as demonstrated in the two example prototype files below. Before files are overwritten during installation, they are copied to a temporary pathname. The exception to this rule is files whose mode includes execute permission, unless the file is editable (that is, ftype is e). For files which meet this exception, the existing version is linked to a temporary pathname, and the original file is removed. This allows processes which are executing during installation to be overwritten. EXAMPLES
Example 1: Example 1: !PROJDIR=/usr/proj !BIN=$PROJDIR/bin !CFG=$PROJDIR/cfg !LIB=$PROJDIR/lib !HDRS=$PROJDIR/hdrs !search /usr/myname/usr/bin /usr/myname/src /usr/myname/hdrs i pkginfo=/usr/myname/wrap/pkginfo i depend=/usr/myname/wrap/depend i version=/usr/myname/wrap/version d none /usr/wrap 0755 root bin d none /usr/wrap/usr/bin 0755 root bin ! search $BIN f none /usr/wrap/bin/INSTALL 0755 root bin f none /usr/wrap/bin/REMOVE 0755 root bin f none /usr/wrap/bin/addpkg 0755 root bin !default 755 root bin f none /usr/wrap/bin/audit f none /usr/wrap/bin/listpkg f none /usr/wrap/bin/pkgmk # the following file starts out zero length but grows v none /usr/wrap/logfile=/dev/null 0644 root bin # the following specifies a link (dest=src) l none /usr/wrap/src/addpkg=/usr/wrap/bin/rmpkg ! search $SRC !default 644 root other f src /usr/wrap/src/INSTALL.sh f src /usr/wrap/src/REMOVE.sh f src /usr/wrap/src/addpkg.c f src /usr/wrap/src/audit.c f src /usr/wrap/src/listpkg.c f src /usr/wrap/src/pkgmk.c d none /usr/wrap/data 0755 root bin d none /usr/wrap/save 0755 root bin d none /usr/wrap/spool 0755 root bin d none /usr/wrap/tmp 0755 root bin d src /usr/wrap/src 0755 root bin Example 2: Example 2: # this prototype is generated by 'pkgproto' to refer # to all prototypes in my src directory !PROJDIR=/usr/dew/projx !include $PROJDIR/src/cmd/prototype !include $PROJDIR/src/cmd/audmerg/protofile !include $PROJDIR/src/lib/proto SEE ALSO
pkgmk(1), pkginfo(4) Application Packaging Developer's Guide NOTES
Normally, if a file is defined in the prototype file but does not exist, that file is created at the time of package installation. However, if the file pathname includes a directory that does not exist, the file will not be created. For example, if the prototype file has the following entry: f none /usr/dev/bin/command and that file does not exist, it will be created if the directory /usr/dev/bin already exists or if the prototype also has an entry defin- ing the directory: d none /usr/dev/bin SunOS 5.10 4 Oct 1996 prototype(4)
All times are GMT -4. The time now is 10:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy