How to store the result of a run file command in a file or variable ?

General

How to store the result of a run file command in a file or variable ?

Hi,

I am trying to store the result of a run file command in a file but the below code does not work.

.EXPORT DATA FILE = DUPLI.BTEQ

.RECORDMODE OFF

.FOLDLINE ALL

SELECT 'SELECT COUNT(*) FROM ( ' ||

'SELECT  ' || GROUP_JOB ||','|| 'COUNT(*) AS CNT_DUP' || '  FROM  ' || TARGET_TABLE || '  WHERE  ' || CONDITION_JOB || '  GROUP BY  ' || GROUP_JOB || '  HAVING CNT_DUP > 1 '|| ' ) A;'

FROM  TABLE1

WHERE USR_NAME='ABC';

.EXPORT RESET

.if errorcode <> 0 then .goto SQL_ERROR

.RUN FILE = DUPLI.BTEQ >> DUPLI_$TIME.txt

Here I am trying to redirect the output of run file to a variable or file but it does not work.

Can somebody help me to achieve that ?

Thanks

1 REPLY
Teradata Employee

Re: How to store the result of a run file command in a file or variable ?

I think you must change this line:

.RUN FILE = DUPLI.BTEQ >> DUPLI_$TIME.txt

and write 

.RUN FILE = DUPLI.BTEQ

instead of.

Then you must process the log file (Did I tell you that you need a log file) to extract what you really want.