Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract generation name based on time from a report dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Extract generation name based on time from a report dataset
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

Moderator Team Head


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

PostPosted: Sat Dec 27, 2008 12:46 am    Post subject: Reply to: Extract generation name based on time from a repo
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    Post subject: Reply to: Extract generation name based on time from a repo
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

Moderator Team Head


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

PostPosted: Sun Dec 28, 2008 9:10 pm    Post subject: Reply to: Extract generation name based on time from a repo
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    Post subject:
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

Site Director


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

PostPosted: Mon Dec 29, 2008 2:03 am    Post subject:
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    Post subject:
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

Moderator Team Head


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

PostPosted: Wed Jan 07, 2009 1:26 am    Post subject: Reply to: Extract generation name based on time from a repo
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us