Convert Decimal to Signed Numeric value

Analytics
Fan

Convert Decimal to Signed Numeric value

Teradata Table structure:
CREATE SET TABLE Table1,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
field1 SMALLINT NOT NULL,
field2 DECIMAL(15,2) NOT NULL,
field3 DECIMAL(15,2) NOT NULL),
UNIQUE PRIMARY INDEX IXCSL1 ( field1 );

Record in Teradata

field1 | field2 | field3
1 | -123456789.31 | 56745111.78

Mainframe file Layout:

01 field2 PIC -(12)9.
01 field3 PIC -(12)9.

Output mainframe file for the Teradata records should look like

field1 | field2
blankspaceblankspace-123456789 | blankspaceblankspaceblankspaceblankspace56745112

I am trying to extract records from Teradata to Mainframe using BTEQ XPORT.

I have used various combinations of cast, format; I can think of. But I am not getting the desired result.

Any help will be appreciated.
2 REPLIES
Teradata Employee

Re: Convert Decimal to Signed Numeric value

Use "Teradata style" cast:

field1 (FORMAT '-(12)9') (CHAR(13))
Fan

Re: Convert Decimal to Signed Numeric value

Wowowo.. It worked!!! Thank you so much!!