How to execute a macro using TPT operator?

Tools

How to execute a macro using TPT operator?

How to execute a macro using TPT operator? Which TPT operator should be used to execute a macro. I tried SQL Selector Operator but got a syntax error. Looks it can be used only for SELECT statements. We are in the process of converting our BTEQ execute macro jobs into TPT jobs. Looking for an example. Thanks in advance.

10 REPLIES
Teradata Employee

Re: How to execute a macro using TPT operator?

Yes, the SQL Selector operator is used only for SELECTs (hence its name).

You can try to use the DDL operator, but it depends on what you are trying to do with the macro.

The DDL operator can be used for most SQL statements, just as long as the SQL statement does not return data to the operator.

-- SteveF

Re: How to execute a macro using TPT operator?

Thanks Steve. The name of the operator misled me as execute macro is a DML statement. Tried the DDL operator and it works fine for DML statements that doesn't return values. Thanks again.

Teradata Employee

Re: How to execute a macro using TPT operator?

Yeah, the operator was originally created to handle just DDL statements, then was expanded, but we cannot change the name.

When in doubt, refer to the documentation for what the operators can and cannot do.

-- SteveF

Re: How to execute a macro using TPT operator?

Will do.

Another simple question. What is the equivalent of BTEQ status values in TPT Selector operator ?  

ACTIVITYCOUNT

ERRORCODE

ERRORLEVEL

I wanted to convert the below BTEQ code into TPT code. Are conditional statements like IF....THEN......ELSE....GOTO allowed in TPT ? 

.IF ERRORCODE <> 0 THEN .QUIT 10;

.IF ACTIVITYCOUNT > 0  THEN .QUIT 12;

.IF ACTIVITYCOUNT = 0 THEN .QUIT 0; 

Teradata Employee

Re: How to execute a macro using TPT operator?

TPT does not currently support IF-THEN-ELSE conditional statements.

-- SteveF

Re: How to execute a macro using TPT operator?

How about ACTIVITYCOUNT, ERRORCODE ? Any parameter in the SELECTOR helps us to identify this ? 

Teradata Employee

Re: How to execute a macro using TPT operator?

TPT does not currently support any IF-THEN-ELSE conditional statements, like ACTIVITYCOUNT and ERRORCODE.

Re: How to execute a macro using TPT operator?

I don't know how but maybe someone have any suggestions on how to simulate condition based on ACTIVITYCOUNT anyway ?

Because I really need to introduce a condition in my JOB

Thanks

Teradata Employee

Re: How to execute a macro using TPT operator?

As already noted, TPT does not currently support conditional logic.

As far as I know there is no other way to simulate conditional logic.

Why do you want to convert a BTEQ script to TPT?

-- SteveF