Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 26 Jan 2011 @ 09:42:57 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Interactive or batch level interface?
 
From:   Stieger, Etienne

Hi Maxmus,

Batch-level interface means that:

1. bteq can be called from any batch scheduler (TWS, CA Unicenter, cron, etc)

2. bteq can have a wrapper created around it (such as Unix shell-script)

3. It can be driven with command-line syntax, without having a human sitting at a keyboard to type instructions.

4. We can have script-driven automation/logic


Interactive ability means it can be started in such a way that a human must sit at the keyboard and interact with the bteq (no automation).

Here is an example of a korn shell shell-script wrapper that makes use of the batch capability of bteq:

     #!/usr/bin/ksh
     ##############################################################################
     ###                                                                          #
     ### ScriptName: execbteq.ksh                                                 #
     ###                                                                          #
     ### Created:  Etienne Stieger  2006-10-31                                    #
     ### Updated:  Etienne Stieger  2006-11-01                                    #
     ###                                                                          #
     ##############################################################################
     ### Description: Acts as a low-level wrapper for executing SQL via bteq.
     ### The export file is purely for capturing any data output from "select" statements.
     #. ${HOME}/.profile
     ### COMMAND_LINE INPUT ARGUMENTS:
     ### $1 = Connect String (for example 'dbc/', 'ml1/', etc -
     ###        OR empty string ("" or '') - IF connection is a local instance of Teradata)
     ### $2 = UID
     ### $3 = PWD
     ### $4 = SQL Statement
     ### $5 = Export file
     ### Read commands from lines following 1st EOF indicator until we reach 2nd EOF indicator bteq << EOF
     .quiet on
     .logon ${1}${2},${3};
     .titledashes off
     .echoreq off
     .export file = '${5}',close ${4}
     .export reset
     .exit EOF RC=${?}
     exit ${RC}
     ### Usage example:
     ### execbteq.ksh 'dbc/' 'myUID' 'myPWD' "select date;" '/tmp/tempfile.txt'
     ### cat /tmp/tempfile.txt

Kind regards

Etienne Stieger



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023