How to convert an integer date to a real date using OS/390 D

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 convert an integer date to a real date using OS/390 D

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 »

The main problem is with the concatenation operator. For the OS/390 version you have to use the double pipe || for concatenating strings. In the solution, Id recommend creating a stage variable where youve done the conversion from integer to character.

Stage Variable:
Name: CharDate, Char with a precision of 8
Derivation: CAST(DSLink3.IntDate AS CHAR(8))

Then the transformer derivation will be:
SUBSTRING(CharDate FROM 1 FOR 4 ) ||
- ||
SUBSTRING(CharDate FROM 5 FOR 2 ) ||
- ||
SUBSTRING(CharDate FROM 7 FOR 2 )

Rich


-----Original Message-----
From: Paul Ko [mailto:PKO@clear.co.nz]
Sent: Sunday, September 30, 2001 4:25 PM
To: datastage-users@oliver.com
Subject: How to convert an integer date to a real date using OS/390 DataSt age


> Hello,
>
> There is a field in a DB2 table that is defined as integer. The field
> is currently storing a valid date. For example, 20010909.
>
> I am trying to use DataStage to convert this to a real date format.
> How can it be done using the OS/390 DataStage component.
>
> My idea is to use substring and cast function to cut and merge the
> integer field into a date field. However, DataStage does not accept
> my syntax.
>
> My syntax is:
> substring(cast(int_field as char) from 2 for 4) cat "-" cat
> substring(cast(int_field as char) from 6 for 2) cat "-" cat
> substring(cast(int_field as char) from 8 for 2)
>
> Please advise on solution.
>
> Cheers,
> Paul.
>
Locked