need to Compare header date in file 1 with system date in file 2

Tools
Enthusiast

need to Compare header date in file 1 with system date in file 2

I have 2 input files i.e file 1 and file2
file 1 is header file which contains date as 02/27/2006
file 2 contains system date
i have to compare file1 and file2 dates if they match i need to process otherwise needs to abend
how can i write Teradata sql

Help me in this regard
Thanks in advance and also thanks for earlier replys to my questions

Regards
Chinnababu

2 REPLIES
Enthusiast

Re: need to Compare header date in file 1 with system date in file 2

Hi,

Assuming file 1 and file 2 are tables on the Teradata you could attempt the following...It doesn't exactly abend, but any future steps won't insert results. It also may not suit your situation.

1. Create a variable table with 1 field (datematch - char(01)), and set the value of that field to 'n'.

2. Run some SQL to update the datematch field in the variable table to 'y' where the dates match.

3. Include a where condition in all future SQL jobs. Eg.

insert into
new_data
Select a.*
from
data a
,variable b
where
b.datematch = 'y'
;

Therefore, when the dates don't match, the datematch field won't be updated, and any insert / delete steps will run, but won't return any results.

You may need to reset the value of datematch to 'n' at the end of all your SQL steps.

Hope this helps...
Teradata Employee

Re: need to Compare header date in file 1 with system date in file 2

abort 'Dates do not match' where date not in (select other_date from mytable);