View previous topic :: View next topic
|
Author |
Message |
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi,
we have a job and It is time triggered to run on Monday and which extract data from Monday + 8 to monday+13
ex: job which runs today(2011-01-16) will extract data from (2011-01-22 to 2011-01-28).
INCLUDE=(DATE1+8 to DATE1+13),
Butif the job fails for some reason, and we can’t re-run until Tuesday. That will mean that the extract will produce records for “Tuesday” to “Sunday”
which will cause problems.
is there any way we can identify the day number and build the sort card dynamically??
say if it is day2=(DATE1-1)+8,day3=(DATE1-2)+8
please help me regarding the same.
Regds,
useit |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why don't you work off a business date/data date (thanks PP)? Then you don't have a re-run problem.
In your proposed example how the would any code know that the date was the wrong one and needed adjusting? |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi,
it is a weekly job and which will run every monday.
Regds,
useit. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, have a look at WEEKDAY=DIGIT1. This will return the day-of-the-week as a number, 1 to 7, for a given date format. Sunday = 1, Monday = 2, etc.
You should then be able to adjust the date range, for day 3, 4, 5, 6, 7 and 1 with some simple maths.
Remember, if you want a re-run which is more than a week out, you have to override the cards (penalty of not using a business/data date). |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
If the job fails... why can't it be fixed and re run on the same day? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Job end at 23:59. or 00:01 even without failing. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
useit,
You can use DFSORT's NEXTDAY functions to get the desired dates. It doesn't matter what the date is . It will always gets the next sunday and the following saturday. I assumed your Lrecl=80 and recfm=fb and the date to be validated is at position 1 in the format ccyymmdd.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20120116 DROP
20120117 DROP
20120118 DROP
20120119 DROP
20120120 DROP
20120121 DROP
20120122 PICK
20120123 PICK
20120124 PICK
20120125 PICK
20120126 PICK
20120127 PICK
20120128 PICK
20120129 DROP
20120130 DROP
20120131 DROP
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(81:DATE1,X,81,8,Y4T,NEXTDSUN,TOGREG=Y4T,X,
90,8,Y4T,NEXTDSAT,TOGREG=Y4T)
OUTFIL BUILD=(1,80),
INCLUDE=((01,8,ZD,GE,90,8,ZD),AND,(01,8,ZD,LE,99,8,ZD))
//* |
|
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
Thanks a lot skolosu....brilliant solution:) thanks a ton..
Regds,
useit |
|
Back to top |
|
|
|