Page 1 of 1

Changing current date to previous day

Posted: Wed May 11, 2005 9:24 am
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")

Re: Changing current date to previous day

Posted: Wed May 11, 2005 10:35 am
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

Posted: Wed May 11, 2005 10:57 am
by SWW
ram1899,

Thanks, it worked perfectly!!

Steve