All Forums General
pratuish 3 posts Joined 09/13
12 Apr 2016
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

AtardecerR0j0 71 posts Joined 09/12
29 Apr 2016

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.

Be More!!

You must sign in to leave a comment.