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
 

 

How to get a future date with Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
anjanav

New User


Joined: 07 Mar 2007
Posts: 1
Location: NY

PostPosted: Wed Mar 07, 2007 7:44 pm    Post subject: How to get a future date with Syncsort
Reply with quote

Hi,

I need to get from a particular Input sequential File of length 350, the records which have not been updated for last 6 months from current date.The update Timestamp is in position 224 to 249.
ie i need to know if UPDT-TIMESTAMP(1:10) > 6 months frm run date.

Is there anyway i can do it using a DFSORT? I went through material but could not figure how to do DATE1 - 6months?

Appreciate your help in this.

Have a good day.

Thanks.
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: Wed Mar 07, 2007 10:22 pm    Post subject:
Reply with quote

You can use INCLUDE or OMIT with DATE1-d where d is the number of days (yyyymmdd-days) or DATE2-m where m is the number of months (yyyymm-m).

For more information, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Thu May 08, 2008 10:27 am    Post subject:
Reply with quote

Dear All,

I am trying to get future/previous date with the below code but getting abend as syntax error :

Code:
//S010   EXEC PGM=ICEMAN                               
//SYSPRINT DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=XXX.PARMLIB(DTEPRM),DISP=SHR
//SORTOUT  DD DSN=XXX.PARMLIB(DTEPRM),       
//            DISP=SHR,SPACE=(TRK,(1,1)),             
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)       
//SYSIN    DD *                                       
    SORT FIELDS=COPY                                   
    OUTREC BUILD=(1,8,DATE1+1,80:X)                   
/*                                                     
//*                                                   


Code:
SYSIN :                                 
    SORT FIELDS=COPY                     
    OUTREC BUILD=(1,8,DATE1+1,80:X)     
                           *             
WER268A  OUTREC STATEMENT  : SYNTAX ERROR
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 08, 2008 11:40 am    Post subject:
Reply with quote

Hello,

You are using Syncsort rather than DFSORT.

What version of Syncsort are you running? The version is shown near the top of the information printed when you execute the sort.
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Thu May 08, 2008 12:19 pm    Post subject: Reply to: How to get a future date with Syncsort
Reply with quote

The version is :

SYNCSORT FOR Z/OS 1.2.1.0R

It doesn't work with SyncSort?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Thu May 08, 2008 1:59 pm    Post subject:
Reply with quote

It works with syncsort as well.
Code:

//SORTIN   DD *                     
20080501                             
20080502                             
20080503                             
20080509                             
20080510                             
//*                                 
//SORTOUT  DD SYSOUT=*               
//*                                 
//SYSIN    DD *                     
   SORT FIELDS=COPY                 
   INCLUDE COND=(1,8,CH,LE,&DATE1-3)
/*                                   


Output
Code:
20080501
20080502
20080503


Thanks,
Arun
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Thu May 08, 2008 2:40 pm    Post subject:
Reply with quote

It still doesn't work for me.
No changes on the sortout file although the abend doesn't happen anymore.

My requirement is I need to dynamically create the parm with the date values depending on when the job will be executed. If it is after 12AM, then I need to get the previous date in CCYYMMDD format.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri May 09, 2008 12:38 am    Post subject:
Reply with quote

Shanthi Jayaraman,
The arcvns card is working fine.Please note that you can olny use the &date with INCLUDE/OMIT conditions.I think ,to achive the final results as you are expecting,you need to have a turn around method.

Thanks
Krishy
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 09, 2008 5:07 am    Post subject:
Reply with quote

Hello,

Quote:
It still doesn't work for me.
I'd suggest you run the test exactly as it is posted. Until you can get the proven test to work on your system, there is no need to try for your version.

Please reply here if the test will work or will not work. We can proceed from there. If it does not work, post the jcl, control statements, the file output, and the queued output from the run.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Fri May 09, 2008 10:26 am    Post subject:
Reply with quote

Hi all,

My earlier post was to compare a date field with an offset of current date. If you are trying to create a future date (say current date+1 ), try out this synctool job.
Code:
//STEP1  EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*   
//DFSMSG   DD SYSOUT=*   
//*                     
//INFILE   DD *                                                 
ABC                                                             
//*                                                             
//TEMP     DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUTFILE  DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
COPY FROM(INFILE) TO(TEMP)    USING(CTL1)                       
COPY FROM(TEMP)   TO(OUTFILE) USING(CTL2)                       
//*                                                             
//CTL1CNTL DD *                                                 
   INREC FIELDS=(1,3,&DATE3)                                   
   SORT FIELDS=COPY                                             
/*                                                             
//CTL2CNTL DD *                                                 
   INREC FIELDS=(1,3,6,5,ZD,ADD,+100001,TO=PD,LENGTH=4)         
   SORT FIELDS=COPY                                             
   OUTREC FIELDS=(1,3,4,4,DT1)                                 
/*                                                             


You can increment the value '+100001' in order to get different offsets.
e.g., '+100002' to get current date + 2.

Thanks,
Arun
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Wed May 14, 2008 9:41 pm    Post subject:
Reply with quote

Dear Dick & Arun,

I've tried the below code and it looks like it didn't work in my system.

Code:
//S020   EXEC PGM=ICEMAN           
//SYSPRINT DD SYSOUT=*             
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD *                   
  20080510                         
  20080511                         
  20080512                         
  20080515                         
  20080516                         
/*                                 
//SORTOUT  DD SYSOUT=*             
/*                                 
//SYSIN    DD *                   
  SORT FIELDS=COPY                 
  INCLUDE COND=(1,8,CH,LE,&DATE1-3)
/*                                 
//*                               



Output :

Code:
********************************* TOP OF DATA **********************************
  20080510                                                                     
  20080511                                                                     
  20080512                                                                     
  20080515                                                                     
  20080516                                                                     
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 14, 2008 9:49 pm    Post subject:
Reply with quote

Hello,

Re-run your test with the input data in the correct columns. The code tests beginning in col1, but you put the data beginning in col3.
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Wed May 14, 2008 9:59 pm    Post subject:
Reply with quote

arcvns wrote:
Hi all,

My earlier post was to compare a date field with an offset of current date. If you are trying to create a future date (say current date+1 ), try out this synctool job.
Code:
//STEP1  EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*   
//DFSMSG   DD SYSOUT=*   
//*                     
//INFILE   DD *                                                 
ABC                                                             
//*                                                             
//TEMP     DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUTFILE  DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
COPY FROM(INFILE) TO(TEMP)    USING(CTL1)                       
COPY FROM(TEMP)   TO(OUTFILE) USING(CTL2)                       
//*                                                             
//CTL1CNTL DD *                                                 
   INREC FIELDS=(1,3,&DATE3)                                   
   SORT FIELDS=COPY                                             
/*                                                             
//CTL2CNTL DD *                                                 
   INREC FIELDS=(1,3,6,5,ZD,ADD,+100001,TO=PD,LENGTH=4)         
   SORT FIELDS=COPY                                             
   OUTREC FIELDS=(1,3,4,4,DT1)                                 
/*                                                             


You can increment the value '+100001' in order to get different offsets.
e.g., '+100002' to get current date + 2.

Thanks,
Arun


Dear Arun,

I've tried this code and it works for me. I am very sorry I was not able to get back on this earlier.

Actually, I have created a COBOL pgm as a solution last week.
But I am still eager to find out solution using SORT utilities and your code has helped me much, in case in future there is similar requirement, I can use utilities instead of creating programs.

Once again, thank you very much for the knowledge...
Back to top
View user's profile Send private message
Shanthi Jayaraman

New User


Joined: 11 Jun 2007
Posts: 26
Location: Malaysia

PostPosted: Wed May 14, 2008 10:17 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

Re-run your test with the input data in the correct columns. The code tests beginning in col1, but you put the data beginning in col3.


Sorry, its my mistake.
This works as well.

Code:
//SORTIN   DD *                   
20080510                           
20080511                           
20080512                           
20080515                           
20080516                           
/*                                 
//SORTOUT  DD SYSOUT=*             
/*                                 
//SYSIN    DD *                   
  SORT FIELDS=COPY                 
  INCLUDE COND=(1,8,CH,LE,&DATE1-3)
/*                                 



Code:
********************************* TOP OF DATA **********************************
20080510                                                                       
20080511                                                                       
20080512                                                                       
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 14, 2008 11:23 pm    Post subject: Reply to: How to get a future date with Syncsort
Reply with quote

Quote:
Sorry, its my mistake.
Not to worry - we all do that from time to time icon_smile.gif

Thank you for posting that it is now working for you.

d
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


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