Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

WEEKDAY with S*U*B*DAYS/ADDDAYS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri May 10, 2013 5:38 pm    Post subject: WEEKDAY with S*U*B*DAYS/ADDDAYS
Reply with quote

Hi,

Could you please let me know how to use WEEKDAY along with SUBDAYS(or ADDDAYS).
This link http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.iceg200%2Fcvtdf.htm
Quote:
TOGREG=Yaa(s) - converts to a gregorian date with separators (for |example, C'2009.09.21').
|
WEEKDAY=CHAR3 - converts to a 3 character day of the week (for |example, C'WED' for Wednesday).

says how to use TOGREG and WEEKDAY similar keywords,

When I try SUBDAYS with TOGREG like this
Code:
11:81,8,Y4T,SUBDAYS,+3,TOGREG=Y4T,2X,

it works fine.

However
SUBDAYS with WEEKDAY
Code:
21:81,8,Y4T,SUBDAYS,+3,WEEKDAY=CHAR3

gives a syntax error.

One more doubt, in the solution you posted here
http://ibmmainframes.com/viewtopic.php?t=60965
you used,
Code:
IFTHEN=(WHEN=NONE,OVERLAY=(84,4,C'-',88,2,C'-',90,2))

instead of
Code:
IFTHEN=(WHEN=NONE,OVERLAY=(84,8,Y4T,2X))

Is it just a personal choice or it is less CPU consuming?

Thanks & Regards,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri May 10, 2013 6:34 pm    Post subject: Reply to: WEEKDAY with SUBDAYS/ADDDAYS
Reply with quote

No Tailgating. New question, new topic :-)
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri May 10, 2013 7:18 pm    Post subject:
Reply with quote

Bill, Thanks :-)
The question was partially related to the techniques and terms used on
http://ibmmainframes.com/viewtopic.php?t=60965
hence I had to followup.

I am glad it was made new topic,
Happy weekend! time for drinks and icon_oak.gif

Thanks & Regards,
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 10, 2013 7:40 pm    Post subject:
Reply with quote

You might also be intrested in this solution then

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
TODAY,S'&WDAY'
//SORTIN   DD *

//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:TODAY,DATE1)),
  IFTHEN=(WHEN=(81,3,CH,EQ,C'FRI'),OVERLAY=(84:DATE1(-)-3)),
  IFTHEN=(WHEN=NONE,OVERLAY=(84:DATE1(-)-1))
icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri May 10, 2013 10:26 pm    Post subject: Re: WEEKDAY with SUBDAYS/ADDDAYS
Reply with quote

vasanthz wrote:

However SUBDAYS with WEEKDAY
Code:
21:81,8,Y4T,SUBDAYS,+3,WEEKDAY=CHAR3

gives a syntax error.


Well WEEKDAY and SUBDAYS are two different functions and syntax wise they are on the same level. Essentially when you are adding/subtracting days from a given date, the result should also be a date and not day of the week.

if you want the weekday function after arithmetic, then you can use the following
Code:

  OUTREC OVERLAY=(81:81,8,Y4T,SUBDAYS,+3,TOGREG=Y4T, 
                  21:81,8,Y4T,WEEKDAY=CHAR3)         


if you look at it , we essentially picked the updated date value at pos 81 and calculated the day of the week.

vasanthz wrote:

One more doubt, in the solution you posted here
http://ibmmainframes.com/viewtopic.php?t=60965
you used,
Code:
IFTHEN=(WHEN=NONE,OVERLAY=(84,4,C'-',88,2,C'-',90,2))

instead of
Code:
IFTHEN=(WHEN=NONE,OVERLAY=(84,8,Y4T,2X))

Is it just a personal choice or it is less CPU consuming?

Thanks & Regards,


well you are comparing apples to oranges. OVERLAY=(84,4,C'-',88,2,C'-',90,2)) is creating the date with separators where as OVERLAY=(84,8,Y4T,2X)) will create the date as CCYYMMDD and padding 2 spaces at the end.

If you need the formatting done automatically you need to specify it differently ex:
Code:
OVERLAY=(84,8,Y4T(-))


I just showed the date formatting manually. Just one of "n" ways to get the results. There will be no difference in CPU for this formatting.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon May 13, 2013 2:44 pm    Post subject:
Reply with quote

Thank you Pandora and Kolusu, learnt something new today.
The similar syntaxes got me confused.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue May 14, 2013 3:32 am    Post subject:
Reply with quote

Pandora-Box wrote:
You might also be intrested in this solution then

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
TODAY,S'&WDAY'
//SORTIN   DD *

//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:TODAY,DATE1)),
  IFTHEN=(WHEN=(81,3,CH,EQ,C'FRI'),OVERLAY=(84:DATE1(-)-3)),
  IFTHEN=(WHEN=NONE,OVERLAY=(84:DATE1(-)-1))
icon_biggrin.gif


Pandora-Box,

1. Were you intentionally creating the dates at position 84 instead of position 1 or within the first 80 bytes?

2. Why do you need DATE1 in your WHEN=INIT when you don't have any plans to use it?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue May 14, 2013 7:35 am    Post subject:
Reply with quote

Hi Kolusu,

81 was intentional for a different problem as you pointed overlay can happen at position 1 and INIT doesn't need DATE1
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue May 14, 2013 11:14 am    Post subject:
Reply with quote

As Kolusu points a better solution now ;)

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
TODAY,S'&WDAY'
//SORTIN   DD *

//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(1:TODAY,DATE1(-)-1)),
  IFTHEN=(WHEN=(1,3,CH,EQ,C'TUE'),OVERLAY=(4:DATE1(-)-3))
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find jobs that are in schedule... anilkumar922 All Other Mainframe Topics 5 Tue Jun 28, 2016 10:01 am
This topic is locked: you cannot edit posts or make replies. BAE Systems - Recruitment Open Days -... Express Mainframe Jobs 0 Fri Apr 22, 2016 8:19 pm
No new posts Write a job to delete the files aging... Abhinav Roy JCL & VSAM 4 Fri Dec 18, 2015 7:17 pm
No new posts Need a query to find 30 days old data mf_karthik DB2 8 Fri Oct 23, 2015 5:24 am
No new posts Date query with 15 days behind AJAYREDDY DB2 1 Tue Sep 22, 2015 1:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us