Storing Date in Integer Field

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
ckaiser1
Participant
Posts: 1
Joined: Fri Jun 24, 2005 2:57 pm

Storing Date in Integer Field

Post by ckaiser1 »

I have an integer column in a database that is initially NULL. I need to read this column in and send the current date back to this integer field in the database with the YYYYMMDD format. I would never design anything this way, but it is what I've been given to work with. I have tried using: Int(Oconv(Date(), "D-YMD[4,2,2]")) as well as Int(Oconv(@DATE, "D YMD[4,2,2]")) and other variations. Although it compiles and runs, the db field is not being populated. Any help would be appreciated.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Try stripping the date separators from the field. For example:

Code: Select all

EReplace(Oconv(Date(),"D-YMD[4,2,2]")),"-","")
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or

Code: Select all

Oconv(Date(), "D-YMD[4,2,2]" : @VM : "MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok, you lost me a little on that one Ray. :? Maybe more than a little.

Not someplace where I can just plug in the syntax, so brain only at this point. It's similar to using the DIGITS transform, but I don't get the use of the value mark. Have to VPN in and check it out...
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Multiple Conversion Technique

Post by ray.wurlod »

Iconv() and Oconv() functions can perform multiple conversions; the list of conversion specifications is presented as a multi-valued field (that is, conversion specifications separated from each other by value marks). It's a handy shortcut sometimes.

The DIGITS Transform is, under the covers, Oconv(%Arg%, "MCN"); it preserves only the numeric digits of its argument.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Multiple Conversion Technique

Post by chulett »

ray.wurlod wrote:Iconv() and Oconv() functions can perform multiple conversions; the list of conversion specifications is presented as a multi-valued field (that is, conversion specifications separated from each other by value marks). It's a handy shortcut sometimes.

Zowie. I had no clue you could do that. 8)
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply