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
 

 

Manipulate date field YYYYMMDD in record

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

New User


Joined: 25 Apr 2007
Posts: 11
Location: Germany

PostPosted: Thu Apr 26, 2007 11:23 am    Post subject: Manipulate date field YYYYMMDD in record
Reply with quote

Hello !

I'm using DFSORT/Icetool in JCL.

In the input record I have a date field with format YYYYDDMM:
Input:
20070430

I want to increase the date by one day:
Output:
20070501

Is this possible ?

Greets, Axel
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 26, 2007 8:55 pm    Post subject:
Reply with quote

Sort products do not have built-in functions for arithmetic on date fields.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Nov 17, 2009 4:17 am    Post subject:
Reply with quote

adoerner,

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707, you can use the new date conversion function TOGREG/TOJUL like shown below to get the desired results
Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *                                               
20070228                                                     
20070430                                                     
20080229                                                     
20081231                                                     
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFOUTLEN=110,                                           
  IFTHEN=(WHEN=INIT,OVERLAY=(81:1,8,Y4T,TOJUL=Y4T)),           
  IFTHEN=(WHEN=INIT,OVERLAY=(81:+1,ADD,81,7,ZD,M11,LENGTH=7)), 
  IFTHEN=(WHEN=INIT,OVERLAY=(01:81,7,Y4T,TOGREG=Y4T)),         
  IFTHEN=(WHEN=(1,1,CH,EQ,C'*'),OVERLAY=(88:81,4,C'1231',       
  88,8,Y4T,TOJUL=Y4T,81:+1,ADD,81,4,ZD,EDIT=(TTTT),             
  85,3,ZD,SUB,100,3,ZD,EDIT=(TTT),01:81,7,Y4T,TOGREG=Y4T))     
//*


The output is

Code:

20070301
20070501
20080301
20090101


For complete details on date conversion functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Oct 30, 2010 1:11 am    Post subject:
Reply with quote

adoerner,

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010), adding number of days is much easier like shown below

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
20070228                                       
20070430                                       
20080229                                       
20081231                                       
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  INREC OVERLAY=(1,8,Y4T,ADDDAYS,+1,TOGREG=Y4T)
//*


The output from this job is
Code:

20070301
20070501
20080301
20090101


For complete details on the new DFSORT and ICETOOL functions available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


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