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
 
Add 1 to Date of format YYYY-MM-DD if found as Sunday

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

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Wed Aug 15, 2012 10:47 pm    Post subject: Add 1 to Date of format YYYY-MM-DD if found as Sunday
Reply with quote

Hi,

I wanted to add +1 to a date if it is found to be a Sunday.
The format of the date is YYYY-MM-DD.

I tried using Y4T option, but looks like it expects in the format of YYYYMMDD.

Please could you help!!

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

Skolusu

Senior Member


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

PostPosted: Wed Aug 15, 2012 11:19 pm    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

madishpa,

1.What is the LRECL and RECFM of the input/output file?
2. What is the position of the date field?
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Thu Aug 16, 2012 3:32 am    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

Hi,

LRECL is 20 and RECFM is FB.

Thanks,
Madishpa
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Thu Aug 16, 2012 3:33 am    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

Hi,

Just to add the date starts at position 1.

Thanks,
Madishpa.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Aug 16, 2012 3:51 am    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

madishpa,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
2012-08-10                                               
2012-08-11                                               
2012-08-12                                               
2012-08-13                                               
2012-08-14                                               
2012-08-15                                               
2012-09-30
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFOUTLEN=20,IFTHEN=(WHEN=INIT,                       
  OVERLAY=(21:1,10,UFF,M11,LENGTH=8,21,8,Y4T,WEEKDAY=CHAR3)),
   IFTHEN=(WHEN=(29,3,CH,EQ,C'SUN'),                         
  OVERLAY=(11:21,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)))           
//*                                                         


The output from this job is
Code:

2012-08-10         
2012-08-11         
2012-08-122012-08-13
2012-08-13         
2012-08-14         
2012-08-15         
2012-09-302012-10-01
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Thu Aug 16, 2012 3:42 pm    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

Hi,

Thank you very much for the reply.
Please could you help advise as what would needs to be done if the date is as follows:

2012-08-12 2012-08-12 2012-08-12 2012-08-11

The expected o/p is as follows:

2012-08-13 2012-08-13 2012-08-13 2012-08-11

As the 2012-08-12 being a Sunday, the day has been incremented.

Appreciate your kind help.

Thanks
Madishpa.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Thu Aug 16, 2012 7:40 pm    Post subject:
Reply with quote

try this..

Code:
//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
2012-08-12 2012-08-12 2012-08-12 2012-08-11                 
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC IFOUTLEN=50,IFTHEN=(WHEN=INIT,                     
  OVERLAY=(51:1,10,UFF,M11,LENGTH=8,51,8,Y4T,WEEKDAY=CHAR3,
  71:12,10,UFF,M11,LENGTH=8,71,8,Y4T,WEEKDAY=CHAR3,         
  91:23,10,UFF,M11,LENGTH=8,91,8,Y4T,WEEKDAY=CHAR3,         
  111:34,10,UFF,M11,LENGTH=8,111,8,Y4T,WEEKDAY=CHAR3)),     
   IFTHEN=(WHEN=(59,3,CH,EQ,C'SUN'),                       
  OVERLAY=(1:51,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT), 
   IFTHEN=(WHEN=(79,3,CH,EQ,C'SUN'),                       
  OVERLAY=(12:71,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT),
   IFTHEN=(WHEN=(99,3,CH,EQ,C'SUN'),                       
  OVERLAY=(23:91,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)),HIT=NEXT),
   IFTHEN=(WHEN=(119,3,CH,EQ,C'SUN'),                       
  OVERLAY=(34:111,8,Y4T,ADDDAYS,+1,TOGREG=Y4T(-)))         
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Thu Aug 16, 2012 8:00 pm    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

Ohh...Thanks..
It helps..

Regards,
Madishpa
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Aug 16, 2012 9:31 pm    Post subject: Re: Reply to: Add 1 to Date of format YYYY-MM-DD if found as
Reply with quote

madishpa wrote:
Hi,

Thank you very much for the reply.
Please could you help advise as what would needs to be done if the date is as follows:

2012-08-12 2012-08-12 2012-08-12 2012-08-11

The expected o/p is as follows:

2012-08-13 2012-08-13 2012-08-13 2012-08-11

As the 2012-08-12 being a Sunday, the day has been incremented.

Appreciate your kind help.

Thanks
Madishpa.


Madishpa,

Can you tell me the trick of storing 4 date fields in CCYY-MM-DD format into a 20 byte FB file?

Why can't you tell us the actual requirement when you cannot modify the control cards supplied to you? You are just wasting not only your time as well as anyone who is trying to help you.

Knickraj,

I am sure you just got a glimpse of the actual number of date fields. It might be a month worth of data that needs to modify and in such cases it is better to go with weekday function to return the day of week in numeric format so that we can reduce the length of the expanded record.
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Fri Aug 17, 2012 3:27 pm    Post subject: Reply to: Add 1 to Date of format YYYY-MM-DD if found as Sun
Reply with quote

Hi,

We we receive these 4 dates from a different application, for which we do not have control as they send these dates to different applications.
As our application alone does not run on a Sunday, we will have to consider incrementing the day by 1 which will be used down the line in the job.

Trust the requirement is clear.

Thanks
Madishpa
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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts Format issues using XMITIP MSGDD ssdjp1 CLIST & REXX 5 Mon Oct 23, 2017 8:47 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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