Sponsored Content
Top Forums Shell Programming and Scripting ksh + isql => output cut at 2 GB Post 302353716 by bereman on Wednesday 16th of September 2009 07:06:31 AM
Old 09-16-2009
ksh + isql => output cut at 2 GB

Using a ksh script, I'm dumping the data from our sybase database into an output file. This output file is for what ever reason cut at 2GB.

There is enough space on the unix machine and as there is no error message is received I have no clue to start looking for a solution.

Code:
#! /usr/bin/ksh

# This scripts extracts data from Sybase for the audit. A complete subscriber dump is retrived
#
# ----------------------------------------------------------------------

checkError()
{
STATUS=$1
if [[ $STATUS != 0 ]] 
then
  echo "[$STATUS] - $2"
  exit $STATUS
fi
}

function getDate
{
  print -n "`date '+%Y%m%d.%H%M%S'`"
}

. $AUDIT_MAIN_HOME/bin/audit.conf

SUBPATH=./$0
export SUBPATH=${SUBPATH%/*}

$SUBPATH/../common/outputFile_date.sh $*

checkError $? "parameter checking failed"

export OUTPUT_FILE=$1
export INPUT_DATE=$2
export INPUT_NDC=470

# replaces .sh by .sql
export SQL_SCRIPT=${0%.sh}.sql
echo SQL_SCRIPT[$SQL_SCRIPT]

. $SUBPATH/db_parameter.sh

SQL_EFFECTIVE_DATE=$INPUT_DATE

# A new temporary query is created
SQL_SCRIPT_TMP=$SQL_SCRIPT.tmp
rm -f $SQL_SCRIPT_TMP

#----------

PROGRAM=$AUDIT_MAIN_HOME/jar/buildQuery.jar
CMD="$JAVA_BIN/java -jar $PROGRAM \
-input_file $SQL_SCRIPT \
-db_area $TMP_DATABASE \
-effective_date $SQL_EFFECTIVE_DATE \
-ndc $INPUT_NDC \
-mapping_file $AUDIT_MAIN_HOME/input/hlrd/pni_hlrd_mapping.xml"
echo CMD[$CMD]
$CMD

SQL_PARAMETERS="$SQL_SCRIPT_TMP $OUTPUT_FILE $SQL_EFFECTIVE_DATE $INPUT_NDC $TMP_DATABASE"
echo "Executing SQL_PARAMETERS[$SQL_PARAMETERS]"

# ISQL
#-----
DBCONNECTION="$SYBASE_OCS/bin/isql -S$SERVER_NAME -U$USER_NAME -P$PASSWD  \
-w1000 -o$OUTPUT_FILE -A8192 -b -i$SQL_SCRIPT_TMP"

echo DBCONNECTION[$DBCONNECTION]

# Defines the start of the query
getDate | read START_TIME
export START_TIME

echo $PASSWD|$DBCONNECTION

# Defines the end of the query
getDate | read END_TIME
export END_TIME

checkError $? "Error in the dump process"

# File created?
[[ -f $OUTPUT_FILE ]]
checkError $? "not created file[$OUTPUT_FILE]"

# build file report
$SUBPATH/../common/fileDescr.sh

checkError $? "pni query failed failed"



---------- Post updated at 01:06 PM ---------- Previous update was at 09:38 AM ----------

Does anyone have an idea why the -o option doesn't create files > 2 GB?
Using the > I can create larger files.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

isql output file not created while running it through cron

#!/bin/ksh file="/pkgs/roots/scripts/ISQL_op.txt" isql -H 11.11.11.111:1111 -U myUser -P myPwd -o $file << eof go select * from Table1 go eof my cron entry 00 08 03 11 * /pkgs/roots/scripts/testc.ksh file permission of the script is correct, i have used absolute path everywhere. ... (2 Replies)
Discussion started by: vikram3.r
2 Replies

2. Shell Programming and Scripting

isql output

hi all i m running following code # set up environment . /u/pimms/pimms_global.ksh echo "Get record from database" #echo ${PIMMS_ID} #echo ${PIMMS_PWD} #echo "1" isql -U${PIMMD_ID} -P${PIMMS_PWD} -S$SRV << eof > /sybase/applications/pimms/bin/automate1.txt use pimms ... (6 Replies)
Discussion started by: d_swapneel14
6 Replies

3. Shell Programming and Scripting

Formatting isql output to horizontal format

Hi I am formatting informix isql output(vertical) to horizontal format. Suppose I have the following content in the flat file from isql output - item_nbr 0 usfn_label Subscriber Class usfn_name SBCLASS usfn_value bl5 item_nbr 1 usfn_label Switch Name usfn_name switchName... (2 Replies)
Discussion started by: nsinha
2 Replies

4. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

5. Shell Programming and Scripting

Extract resultset numeric value from isql output ?

isql output comes as below, (0 rows affected) (1 row affected) (7 rows affected) How to extract the resultset number alone from the particular line ?? such as 0 1 7 (3 Replies)
Discussion started by: vikram3.r
3 Replies

6. Shell Programming and Scripting

How to assign record count output of isql to a shell variable ?

isql select count(*) from Table eof How to assign record count output of isql query to a shell variable ? (4 Replies)
Discussion started by: vikram3.r
4 Replies

7. Shell Programming and Scripting

Issue with redirecting a ISQL output to a file

Hi all, I have wrote a script to redirect the output of Sybase query to a file. Its a single XML message i am fetching with sybase query. The problem i faced here is the XML message line crosses the normal line limit in unix. Could some please help me how to get complete xml message... (1 Reply)
Discussion started by: ravin
1 Replies

8. Shell Programming and Scripting

Return value inside isql to a shell variable in ksh

Hello, I have a shell script where I am doing an isql to select some records. the result i get from the select statement is directed to an output file. I want to assign the result to a Shell variable so that I can use the retrieved in another routine. e.g. "isql -U${USER} -P${PASSWD} -S${SERVER}... (1 Reply)
Discussion started by: RookieDev
1 Replies

9. Shell Programming and Scripting

How to get the output of a ISQL command in a variable?

I am trying to run a query which returns a sum value(a number). I want to get it in a variable so that i can refer to that variable in different places. when i am running the following command variable=`isql -Uuser -Sserver -Ppassword 1> select sum(count(*)) from xyz..abc where clm_id... (2 Replies)
Discussion started by: Sharma331
2 Replies

10. Shell Programming and Scripting

How to handle NULL value output from ISQL command?

I am using ISQL command in ksh script. Suppose if i get NULL value from the query which i run,how can i handle it? I am getting a NULL result set and the following error is coming. ############### output of isql command for getting the sum of JEs ################ ----------- NULL... (4 Replies)
Discussion started by: Sharma331
4 Replies
suspend(1)							   User Commands							suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy