|
View previous topic :: View next topic
|
| Author |
Message |
anjanav
New User
Joined: 07 Mar 2007 Posts: 1 Location: NY
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
The version is :
SYNCSORT FOR Z/OS 1.2.1.0R
It doesn't work with SyncSort? |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
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 |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
| 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 |
|
 |
Shanthi Jayaraman
New User
Joined: 11 Jun 2007 Posts: 26 Location: Malaysia
|
|
|
|
| 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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
| Quote: |
| Sorry, its my mistake. |
Not to worry - we all do that from time to time
Thank you for posting that it is now working for you.
d |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|