View previous topic :: View next topic
|
Author |
Message |
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
Hi,
I need to remove the duplicates from the file using few perticular fields.
Please give me the statement for it. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Well this statement is for free :
What did you try yourself? |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
I did't try anything.
But my PL told me that it can be done using DFSORT. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
The DO something instead asking others for a ready made solution. Im not working for your PL. |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
Its not like that i haven't tried. But watever I have given it throws JCL error.
So thats Y I said I need a statement.
If you have some idea tell me, I will try that. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Then show us what you did. JCL, input, expected output, JES messages, sort messages, fields you want to operate on etc. |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
Ok I have written the following step
//*********************************************************************
//STEPAAAA EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
IN5281013PB 2010-11-22-11.51.13.241123
IN5281013PB 2010-11-22-11.51.13.241109
IN5281023PB 2010-11-22-11.51.13.241176
IN5281047PB 2010-11-22-11.51.13.241189
IN5281047PB 2010-11-22-11.51.13.241437
IN5281047PB 2010-11-22-11.51.13.241490
IN5281053PB 2010-11-22-11.51.13.241504
IN5281059PB 2010-11-22-11.51.13.241557
IN5281053PB 2010-11-22-11.51.13.241610
IN5281053PB 2010-11-22-11.51.13.241624
//OUT DD DSN=I50TS.UNLOAD.IMTSIH.TEMP1,DISP=SHR
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,15,CH) LAST
/*
Using this JCL i m getting the last dup record. But now I want the record which has greater timestamp
eg.
IN5281013PB 2010-11-22-11.51.13.241123
IN5281013PB 2010-11-22-11.51.13.241109
Out of two above records i want in the output file
IN5281013PB 2010-11-22-11.51.13.241123
So Please guide me. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the requirements have changed in two hours !
the only thing where You need guidance is how to express clearly and unambiguously Your requirements
didn' t You know You wanted the highest <thing> to start with ??? |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
Ok I m sorry for that.
But can u please provide me the solution. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your date field starts in position 16 - adjust as necessary.
Code: |
//STEPAAAA EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
IN5281013PB 2010-11-22-11.51.13.241123
IN5281013PB 2010-11-22-11.51.13.241109
IN5281023PB 2010-11-22-11.51.13.241176
IN5281047PB 2010-11-22-11.51.13.241189
IN5281047PB 2010-11-22-11.51.13.241437
IN5281047PB 2010-11-22-11.51.13.241490
IN5281053PB 2010-11-22-11.51.13.241504
IN5281059PB 2010-11-22-11.51.13.241557
IN5281053PB 2010-11-22-11.51.13.241610
IN5281053PB 2010-11-22-11.51.13.241624
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,15,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,15,CH,A,16,26,CH,D)
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
But watever I have given it throws JCL error. |
What was the JCL error?
Code: |
//OUT DD DSN=I50TS.UNLOAD.IMTSIH.TEMP1,DISP=SHR |
Even if the job is running now, suggest you NOT use this DD statement. SHR is probably the worst choice for your output file. . . You should ask your project seniors if this is acceptable on your system - on most (all that i've ever worked on) it is not permitted. |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
@Frank Yaeger
Thnks for th reply it worked out.
Actualy I was also using same JCL but I havnt given the initial spaces for the "SORT FIELDS" statement.
@dick scherrer
No In our Project we need to use SHR only |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
No In our Project we need to use SHR only |
How unfortunate
I wonder how many jobs have generated incorrect output that has not been recognized. . . Maybe when there are abends, it will be recognized. . . |
|
Back to top |
|
|
ppravin47
New User
Joined: 23 Mar 2010 Posts: 17 Location: Bangalore
|
|
|
|
@dick scherrer
I didnt got, why jobs will generate incorrect data? and it will abend?
As per I know if we give files in SHR mode. And job is using that file then at that time I can OPEN the file only in VIEW mode(I cant open in EDIT mode)... |
|
Back to top |
|
|
giraffe
New User
Joined: 09 Nov 2010 Posts: 27 Location: SHENZHEN CHINA
|
|
|
|
This is my frequently-used solution:
Code: |
SORT FIELDS=(...)
SUM FIELDS=NONE |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your frequently used solution wil NOT work in this case because the OP is trying to SORT with SUM on one field, but SORT without SUM on another field. You can't do that with SORT and SUM, but you can do it with SELECT as shown.
Please test your "solutions" before posting them. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
another job can have shr, but OPEN OUTPUT. |
|
Back to top |
|
|
|