View previous topic :: View next topic
|
Author |
Message |
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I have the following information in my dataset. This is basically a report in which backup information of a file is maintained. One file is being backed- up daily through one job. Sometimes that job may run or due to some issue it may run next day. I want to extract the exact generation name which was backed-up on the last day of every month. For example, from below dataset I want to extract the generation which was backed-up
on 09/30/2008. But it's not present there so I'll go for 10/01/2008 which will run first out of two instances (because it will have transaction of 09/30/2008)
Code: |
DSN NAME CRT DT TIME
PQR.C0.BKUP.G3464V00 09/29/2008 231101
PQR.C0.BKUP.G3465V00 10/01/2008 015832
PQR.C0.BKUP.G3466V00 10/01/2008 234840
PQR.C0.BKUP.G3467V00 10/02/2008 234840
PQR.C0.BKUP.G3468V00 10/03/2008 234840
PQR.C0.BKUP.G3469V00 10/04/2008 234840
PQR.C0.BKUP.G3470V00 10/05/2008 234840
|
Can someone help me out to extract the generation through rexx code? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
How many months back do you need to go when you calculate what the dates are for the last day of each of those months? |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
There is will be some predefined value every time i want to run this code,
that value i will read from one dataset . (it is generally having value one month prior to the current month)
you can consider the value 11/30/2008 to retrive the generation name |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Well, I guess that I would start with the given date and read the report, looking for the generation that matches on that date. If not found, then I'd increment the date by 1 day and try again. Obviously, I'd include a maximum value of the number of attempts to try before ending with an error message. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
and what about if the jobs runs twice ? we also need to consider the timings of the job . if the job which run first(out of two) that will be a valid one. Can you please help me out with some code...
thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you not worry about multiple runs in the same day. When you do not get a hit on 09/30, you simply use the next entry (greater than 09/30 - reformat the date to be yyyymmdd for comparing). As you have explained, there will be one per day, unless a day is missed in which case you want the "next" one. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
Can you please provide me the rexx code to increment the date if no entry found for required date |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
It's all in the DATE function:
Code: |
/* REXX */
...
thedate = 'MM/DD/YYYY' /* Date value in mm/dd/yyyy format */
Parse Var thedate mm '/' dd '/' yyyy .
/* Convert to REXX Sorted Date DATE(S) format */
dates = yyyy||mm||dd
/* Convert to REXX Base Date DATE(B) format and add 1,*/
/* then convert back into the REXX Sorted Date DATE(S) format */
dates = Date('S',(Date('B',dates,'S')+1),'B')
Parse Var dates 1 yyyy 5 mm 7 dd .
thedate = mm'/'dd'/'yyyy
...
|
|
|
Back to top |
|
|
|