IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to get a future date with Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Wed Mar 07, 2007 10:22 pm
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:

Use [URL] BBCode for External Links
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
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

Moderator Emeritus


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

PostPosted: Thu May 08, 2008 11:40 am
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
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: 2481
Location: @my desk

PostPosted: Thu May 08, 2008 1:59 pm
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
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
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

Moderator Emeritus


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

PostPosted: Fri May 09, 2008 5:07 am
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: 2481
Location: @my desk

PostPosted: Fri May 09, 2008 10:26 am
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
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

Moderator Emeritus


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

PostPosted: Wed May 14, 2008 9:49 pm
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
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
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

Moderator Emeritus


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

PostPosted: Wed May 14, 2008 11:23 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top