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

EXTRRCT DAY NUMBER USING JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon Jan 16, 2012 3:58 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 16, 2012 4:06 pm
Reply with quote

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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon Jan 16, 2012 4:14 pm
Reply with quote

hi,
it is a weekly job and which will run every monday.

Regds,
useit.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 16, 2012 4:24 pm
Reply with quote

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

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jan 16, 2012 4:25 pm
Reply with quote

If the job fails... why can't it be fixed and re run on the same day?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 16, 2012 4:28 pm
Reply with quote

Job end at 23:59. or 00:01 even without failing.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jan 16, 2012 10:34 pm
Reply with quote

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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Jan 17, 2012 10:14 am
Reply with quote

Thanks a lot skolosu....brilliant solution:) thanks a ton..

Regds,
useit
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top