Regarding conversions

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dwh.com
Participant
Posts: 22
Joined: Sat Jun 28, 2008 12:38 pm

Regarding conversions

Post by dwh.com »

frens,

source is .txt file

i have two columns ,
column1 has data -20170331 (yyyymmdd)
column2 has data -31052008 (ddmmyyyy)

my requirement is to calculate remaining days by subtracting column1-column2


to get it done i have coverted those column valeus to date and i have subtracted it ,
and my output column is numeric where these subtracted values has to be stored,
but when i tried to calculate days am getting values as o(zero)

below is the conversions used.

OCONV(iconv(20170331,"D YMD[4,2,2]"),"D-DMY[2,A3,4]")
-
OCONV(iconv(31052008,"D DMY[2,2,4]"),"D-DMY[2,A3,4]")

Please tell how to proceed with this.

Rgds,
Sriks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You subtract the internal values to get the number of days between, so ditch the OConv otherwise you're just 'subtracting' two strings.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dwh.com
Participant
Posts: 22
Joined: Sat Jun 28, 2008 12:38 pm

Post by dwh.com »

chulett wrote:You subtract the internal values to get the number of days between, so ditch the OConv otherwise you're just 'subtracting' two strings. ...
is there any other way to do this?

if so please let me know...

i have stored those two columns in other file by converting it to date and i used those columns which contains date to calculate days by subtracting those..but still i got the same result 0(zero)..but not the expected one..

thanks in advance

sriks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No. :?

IConv. Subtract. Done.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dwh.com
Participant
Posts: 22
Joined: Sat Jun 28, 2008 12:38 pm

Post by dwh.com »

chulett wrote:No. :?

IConv. Subtract. Done. ...
thanks Craig :)
Post Reply