BTEQ REPORT

Tools
Enthusiast

BTEQ REPORT

Hi,

I'm using the following code to create a report.

<LOGON COMMAND>

.EXPORT REPORT FILE=MY_FILE.TXT

SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;

<LOGOFF COMMAND>

I'm getting the output as follows:

COLUMN1      COLUMN2      COUNT(*)

------------       ------------      -------------

col1a              col2a             100

col1b              col2b             200

col1c              col2c              150

But, I'm expecting my report to include my actual query and not to display the columns names as title.  Below is the sample.

SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;

col1a              col2a             100

col1b              col2b             200

col1c              col2c              150

Please assist.  Thanks in advance.

Govi

Tags (2)
4 REPLIES
Enthusiast

Re: BTEQ REPORT

use following command in your bteq script:

.SET FORMAT OFF;

.SET TITLEDASHES OFF;

Enthusiast

Re: BTEQ REPORT

@anjanpaul:

I've tried these included but my purpose is not served.

.SET FORMAT OFF;  --i'm already using this.  Sorry that I missed to mention.

.SET TITLEDASHES OFF;

this helped me to have the dashes removed but not the title.  I added (TITLE '') to the end of my query to get the title removed and that worked.

Now, my report is in shape except for one, the query itself. 

Senior Supporter

Re: BTEQ REPORT

There is not possibilty to get this automated.

you would need to do it manually

select 'select what_ever from tab order by 2,3,5' (title'');

Be carefull with in query ' which would need to be replaced with ''.

Alternative create a small Java function to write the SQL into a file and export the data into the same file. Should be easier to achive what you want fully automated.

Enthusiast

Re: BTEQ REPORT

SELECT 'SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;' (TITLE '');

SELECT COLUMN1 (TITLE '')

, COLUMN2 (TITLE '')

, COLUMN3 (TITLE '')

FROM MY_TABLE;

Outputing the actual SQL will be a manual process as the query needs to be hardcoded.

You can get rid of the column names by using the empty title.