How to subtract 1 day from a parameter date in the transform

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

How to subtract 1 day from a parameter date in the transform

Post by admin »

This is a topic for an orphaned message.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Firstly transform the date paramater into Datastage internal date and then subtract 1 from it:

iconv(Date, "DYMD") -1

if you want the result back in the same date format as the date passed:

oconv(iconv(Date, "DYMD") -1, "D-YMD")

regards,
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 3, 1 Southbank Boulevard,
Southbank, Victoria 3006
E-mail: wendy.voon@team.telstra.com
Telephone: (03) 8696 - 5023


> -----Original Message-----
> From: Paul Ko [SMTP:PKO@clear.co.nz]
> Sent: Thursday, 1 November 2001 2:37 pm
> To: datastage-users@oliver.com
> Subject: How to subtract 1 day from a parameter date in the transform
> stag e for OS/390
>
> Hello,
>
> I have a date reading from a parameter file. Its format is
> CCYY-MM-DD.
>
> What I wish to achieve is to subtract 1 from the parameter date? Mind
> that I am using Datastage OS/390.
>
> I tried the following command but it did not return the expected
> result. The result returns me with the original date.
>
> Below is my command used in the TRANSFORMATION stage:
> CAST(((CAST((CAST(JobParam.P_SNPSHT_DT AS DATE)) AS INT)) - 1) AS
> DATE)
>
> The 3rd CAST is to convert the parameter date (in char format) to a
> date format. The 2nd CAST is to convert the date into integer.
> The 1st CAST is to convert the integer (after subtracting 1) to a date.
>
> Cheers,
> Paul.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Wendy,
The functions you know and love are not available in DS/390 (mainframe jobs). This is why Paul specified that hes using the mainframe version.

-----Original Message-----
From: Voon, Wendy [mailto:Wendy.Voon@team.telstra.com]
Sent: Thursday, 01 November 2001 15:00
To: datastage-users@oliver.com
Subject: RE: How to subtract 1 day from a parameter date in the transform stag e for OS/390


Firstly transform the date paramater into Datastage internal date and then subtract 1 from it:

iconv(Date, "DYMD") -1

if you want the result back in the same date format as the date passed:

oconv(iconv(Date, "DYMD") -1, "D-YMD")

regards,
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 3, 1 Southbank Boulevard,
Southbank, Victoria 3006
E-mail: wendy.voon@team.telstra.com
Telephone: (03) 8696 - 5023


> -----Original Message-----
> From: Paul Ko [SMTP:PKO@clear.co.nz]
> Sent: Thursday, 1 November 2001 2:37 pm
> To: datastage-users@oliver.com
> Subject: How to subtract 1 day from a parameter date in the transform
> stag e for OS/390
>
> Hello,
>
> I have a date reading from a parameter file. Its format is
> CCYY-MM-DD.
>
> What I wish to achieve is to subtract 1 from the parameter date? Mind
> that I am using Datastage OS/390.
>
> I tried the following command but it did not return the expected
> result. The result returns me with the original date.
>
> Below is my command used in the TRANSFORMATION stage:
> CAST(((CAST((CAST(JobParam.P_SNPSHT_DT AS DATE)) AS INT)) - 1) AS
> DATE)
>
> The 3rd CAST is to convert the parameter date (in char format) to a
> date format. The 2nd CAST is to convert the date into integer.
> The 1st CAST is to convert the integer (after subtracting 1) to a date.
>
> Cheers,
> Paul.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

This is a mainframe job!

-----Original Message-----
From: Voon, Wendy [mailto:Wendy.Voon@team.telstra.com]
Sent: Thursday, November 01, 2001 5:00 PM
To: datastage-users@oliver.com
Subject: RE: How to subtract 1 day from a parameter date in the transform stag e for OS/390


Firstly transform the date paramater into Datastage internal date and then subtract 1 from it:

iconv(Date, "DYMD") -1

if you want the result back in the same date format as the date passed:

oconv(iconv(Date, "DYMD") -1, "D-YMD")

regards,
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 3, 1 Southbank Boulevard,
Southbank, Victoria 3006
E-mail: wendy.voon@team.telstra.com
Telephone: (03) 8696 - 5023


> -----Original Message-----
> From: Paul Ko [SMTP:PKO@clear.co.nz]
> Sent: Thursday, 1 November 2001 2:37 pm
> To: datastage-users@oliver.com
> Subject: How to subtract 1 day from a parameter date in the transform
> stag e for OS/390
>
> Hello,
>
> I have a date reading from a parameter file. Its format is
> CCYY-MM-DD.
>
> What I wish to achieve is to subtract 1 from the parameter date? Mind
> that I am using Datastage OS/390.
>
> I tried the following command but it did not return the expected
> result. The result returns me with the original date.
>
> Below is my command used in the TRANSFORMATION stage:
> CAST(((CAST((CAST(JobParam.P_SNPSHT_DT AS DATE)) AS INT)) - 1) AS
> DATE)
>
> The 3rd CAST is to convert the parameter date (in char format) to a
> date format. The 2nd CAST is to convert the date into integer.
> The 1st CAST is to convert the integer (after subtracting 1) to a date.
>
> Cheers,
> Paul.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

Paul,

Your technique is valid. What release of DataStage are you running? Have you checked with Ascential support to assure you have the correct patch levels installed on your client workstation?

Mike Ruland.

-----Original Message-----
From: Paul Ko [mailto:PKO@clear.co.nz]
Sent: Wednesday, October 31, 2001 9:37 PM
To: datastage-users@oliver.com
Subject: How to subtract 1 day from a parameter date in the transform stag e for OS/390


Hello,

I have a date reading from a parameter file. Its format is CCYY-MM-DD.

What I wish to achieve is to subtract 1 from the parameter date? Mind that I am using Datastage OS/390.

I tried the following command but it did not return the expected result. The result returns me with the original date.

Below is my command used in the TRANSFORMATION stage: CAST(((CAST((CAST(JobParam.P_SNPSHT_DT AS DATE)) AS INT)) - 1) AS DATE)

The 3rd CAST is to convert the parameter date (in char format) to a date format. The 2nd CAST is to convert the date into integer. The 1st CAST is to convert the integer (after subtracting 1) to a date.

Cheers,
Paul.
Locked