writting routinue

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
ysrini9
Participant
Posts: 108
Joined: Tue Jul 12, 2005 2:51 am

writting routinue

Post by ysrini9 »

Hai This is my Requirement can u guide me on that

i will enter date ,month ,year and somenumber here if i enter correct values means its shows its valid otherwise itsnot valid and here one condition i will enter the +100 that number of time add the value and display..or i will enter -100 that number of time subtract ..

please help on that i would like to write routinue on this issue...

Thanks & with Regards
ysrini9
venkat n
Participant
Posts: 29
Joined: Fri Mar 18, 2005 3:28 am

Re: writting routinue

Post by venkat n »

Hi srini9,
where u r giving the data month year and no coloumns
in parameters window? or in transformer stage?
I think u have to give the date format as yyyy-mm-dd format as a paramter whereever it might be u can use this parameter (in jobcontrol routines or somewhere else)

Thanks & with Regards
ysrini9[/quote]
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

ysrini9,

Could you please give more details,
what do u mean by valid? will u be comparing the format for validity or will you be comparing it with some default value?
Second part of your question is even more confusing.

If possible rephrase your question and explain your requirement with an example. like what is ur input value ? and on which condition, you want do what type of operation and what should be the final value for each of the condn..?
Shantanu Choudhary
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

I think a one example for each scenario will clarify your requirements. Maybe you will yourself find the solution that way.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I think that the OP is seeking a routine that returns a flag that indicates whether a combination of day, month and year represents a valid date. It can be run from the Test grid or from within a job, etc.

Code: Select all

FUNCTION IsValidDate(Day, Month, Year)

Ans = @NULL
If UnAssigned(Day) Or UnAssigned(Month) Or UnAssigned(Year)
Then
   GoTo MainExit
End
If IsNull(Day) Or IsNull(Month) Or IsNull(Year)
Then
   GoTo MainExit
End

* Now we can check whether the date is valid.  
* Assemble them into a human-readable date, apply an Iconv()
* function, and test the value of Status().  If this is zero, then the
* arguments represent a valid date.
* Month may be numeric (1-12), a month name or abbreviation.

TheDate = Year : "-" : Month : "-" : Year
IntDate = Iconv(TheDate, "DYMD")
Ans = (Status() = 0)

MainExit:

RETURN(Ans)
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