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
 

 

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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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