IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract generation name based on time from a report dataset


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Fri Dec 26, 2008 11:58 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat Dec 27, 2008 12:46 am
Reply with quote

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
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Sun Dec 28, 2008 12:08 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sun Dec 28, 2008 9:10 pm
Reply with quote

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
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Sun Dec 28, 2008 11:36 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 29, 2008 2:03 am
Reply with quote

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
View user's profile Send private message
pdighade

New User


Joined: 21 Jul 2008
Posts: 40
Location: pune

PostPosted: Tue Jan 06, 2009 11:08 pm
Reply with quote

Can you please provide me the rexx code to increment the date if no entry found for required date
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 07, 2009 1:26 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top