Job Paramiter using Date datatype

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
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Job Paramiter using Date datatype

Post by JDionne »

I have created a job paramiter with the date datatype and I want to put in some default code that will dynamicaly produce a date. Ie OCONV(DATE(),'D-YMD')

From what I have read in the DS help files the Date() function should only return the date not time. When I put this code into the paramiter to run the job i get the error that i must include a valid date (not including time)

is there a function that will dynamicaly give me the date that I can use with the date datatype in a job paramiter?
Jim
Sure I need help....But who dosent?
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: Job Paramiter using Date datatype

Post by raju_chvr »

The Date() function returns an integer. So it doesn't have any timestamp in it.

Can you post the error ur having ? Did u try X = Oconv(Date(), "D") just the regular one.

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

Re: Job Paramiter using Date datatype

Post by chulett »

JDionne wrote:I have created a job paramiter with the date datatype and I want to put in some default code that will dynamicaly produce a date. Ie OCONV(DATE(),'D-YMD')
That technically should work fine as the Date type expects data in 'YYYY-MM-DD' format. Can you explain what you mean by "I put this code into the paramiter to run the job"? Are you writing Batch Job Control to do this or is this via a Sequence Job or ?? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Re: Job Paramiter using Date datatype

Post by JDionne »

chulett wrote:
JDionne wrote:I have created a job paramiter with the date datatype and I want to put in some default code that will dynamicaly produce a date. Ie OCONV(DATE(),'D-YMD')
That technically should work fine as the Date type expects data in 'YYYY-MM-DD' format. Can you explain what you mean by "I put this code into the paramiter to run the job"? Are you writing Batch Job Control to do this or is this via a Sequence Job or ?? :?
when i go into director and click on the little blue arrow i have a paramiters tab along with my limits tab and traceing tab. I have to put in a value at this point for the job paramiter. i put in OCONV(DATE(),'D-YMD') and get a pop up window that tells me i have to add a date to the field when i try to click ok.
Jim
Sure I need help....But who dosent?
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

If you are running a job from Director and a job parameter is of datatype DATE, you MUST supply a value and it MUST in be the form of YYYY-MM-DD. This is a literal value.

During job control execution of a job you must supply a value and it also must be in the form YYYY-MM-DD.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post by JDionne »

kcbland wrote:If you are running a job from Director and a job parameter is of datatype DATE, you MUST supply a value and it MUST in be the form of YYYY-MM-DD. This is a literal value.

During job control execution of a job you must supply a value and it also must be in the form YYYY-MM-DD.

agreed, so Oconv(date(), "D-YMD[4,2,2]") should work, at least in my mind it should..but it does not. is there a better way to do this so that I have a constant load date, with out a time stamp?
Jim
Sure I need help....But who dosent?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You must have missed the "This is a literal value." part, Jim. You must explicity input the date in the Director, you can't plug in a "transform" there and expect it to run.

Use a Stage Variable. Put your transform in as the Initial Value (it will run and be evaluated there - once) and then use it to populate your field in the job. Either that or write a Job Control 'wrapper' for the job to determine this value for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
JDionne
Participant
Posts: 342
Joined: Wed Aug 27, 2003 1:06 pm

Post by JDionne »

I rewrote my stage variable and it is doing what I want it to do. Thanx for clearing up what a job paramiter is capable of.
Jim
Sure I need help....But who dosent?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

JDionne wrote:Oconv(date(), "D-YMD[4,2,2]") should work, at least in my mind it should..but it does not. is there a better way to do this so that I have a constant load date, with out a time stamp?
Jim
Date() returns the system date. Prefer the system variable @DATE, which has its value set at the beginning of the job and does not change subsequently. Similarly prefer @TIME to Time(). The initial value for a start timestamp stage variable could then be generated from these.
You could also use the DSJobStartTimeStamp macro, or the DataStage function DSGetJobInfo(DSJ.ME, DSJ.JOBSTARTTIMESTAMP), which is the same thing.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply