Changing current date to previous day

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
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Changing current date to previous day

Post by SWW »

Hi All,

I am using a control job with a date parameter to capture a date and apply that date to an output name of a file I am creating. Using this coding, I can set the parameter to the current date or the date I run the job. The job is actually processing the previous days activities and I would like name the file for that day. In the file name field I use #LOAD_DTTM_Parm1# as the date parameter. I have tried as I assign the value to the variable below this:

sLOAD_DTTM_Parm1 = (sExternalDatePortion -1)

But this only gives me the value of -1 so my file name looks like this:
CRCDATE-1 instead of CRCDATA2005-05-10.

Is there another way, using the coding below the subtract a day from the current date?

Thanks in advance.

Steve




* to convert the Date portion to format as in 1997-06-03
sInternalDatePortion = Iconv(sDatePortion, "D DMY[,A3,4]")
sExternalDatePortion = Oconv(sInternalDatePortion, "D-YMD[4,2,2]")
Call DSLogInfo(" *** display - sInternalDatePortion = ":sInternalDatePortion, "JobControl")
Call DSLogInfo(" *** display - sExternalDatePortion = ":sExternalDatePortion, "JobControl")

* to concatenate the Date and Time to the environment filename
sLOAD_DTTM_Parm1 = sExternalDatePortion
Call DSLogInfo(" *** LOAD_DTTM_Parm1 - LOAD_DTTM_Parm1 = ":sLOAD_DTTM_Parm1, "JobControl")
SWKYDERBY
ram1899
Charter Member
Charter Member
Posts: 41
Joined: Wed Aug 04, 2004 11:46 am

Re: Changing current date to previous day

Post by ram1899 »

Hi Steve
If it always if you date should previous day then I sugget you to convert your input date using Iconv as it will convert you date to internal format ( Integer Value ) you substract one from this and and do a Oconv in the Date format you would like to


Hope this will help

Thank you
ram1899
SWW
Participant
Posts: 29
Joined: Thu Nov 11, 2004 12:51 pm
Location: Louisville

Post by SWW »

ram1899,

Thanks, it worked perfectly!!

Steve
SWKYDERBY
Post Reply