View previous topic :: View next topic
|
Author |
Message |
Raghuraman_New
New User
Joined: 03 Oct 2008 Posts: 43 Location: Chennai,India.
|
|
|
|
Hi ,
The Input file data format is as below,
Key1 data1
Key1 data2
Key1 data3
Key1 data4
Key1 data5
.
.
Key2 data7
Key2 data5
Key2 data6
Key2 data8
.
.
Key3 data10
Key3 data11
Key3 data12
Key3 data13
Key3 data15
Key3 data16
Key3 data17
.
.
I need a Output file as follows ,
Key1 data1
Key1 data2
Key1 data3
Key2 data7
Key2 data5
Key2 data6
Key3 data10
Key3 data11
Key3 data12
.
.
Exactly first 3 records from each Section of the input file.(Each Section may contain any no.of record).
Is this possible in Sort |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Raghuraman_new,
You can do this quite easily with the new SELECT with first n duplicates function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
KEY1 DATA1
KEY1 DATA2
KEY1 DATA3
KEY1 DATA4
KEY1 DATA5
KEY2 DATA7
KEY2 DATA5
KEY2 DATA6
KEY2 DATA8
KEY3 DATA10
KEY3 DATA11
KEY3 DATA12
KEY3 DATA13
KEY3 DATA15
KEY3 DATA16
KEY3 DATA17
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,4,CH) FIRST(3)
/* |
if you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).
For complete details on the new SELECT with first n duplicates and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Hope this helps...
Cheers |
|
Back to top |
|
|
Raghuraman_New
New User
Joined: 03 Oct 2008 Posts: 43 Location: Chennai,India.
|
|
|
|
Hi Skolusu ,
Thanks for the immediate reply.We don't have upadted version of DFSORT , Can you help to do it in older version(Syncsort)? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Raghuram,
Syncsort is NOT DFSORT's older version. Both are entirely different products. You need to tell us which product you are having. |
|
Back to top |
|
|
Raghuraman_New
New User
Joined: 03 Oct 2008 Posts: 43 Location: Chennai,India.
|
|
|
|
Hi ,
Sorry for the confusion i made ,we have only the older version of Synsort(2005). Is it achievable with this? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Raghuram,
Check your SYSOUT messages. On the top of the page you'll find the version/release info. |
|
Back to top |
|
|
JayC
New User
Joined: 27 Sep 2008 Posts: 70
|
|
|
|
Hi Skolusu,
I tried the above code but got the following error :
Code: |
"FIRST" OPERAND IS NOT FOLLOWED BY A BLANK
OPERATION COMPLETED WITH RETURN CODE 12
|
This would mean that my shop's DFSORT isn't exactly the latest. Right ?
how can I check.
My sysout shows the Synctool 1.5.3 is being used. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
JayC,
That shows you are using SYNCSORT and not DFSORT. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Raghuram,
The below Syncsort job should work for your requirement.
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
KEY1 DATA1
KEY1 DATA2
KEY1 DATA3
KEY1 DATA4
KEY1 DATA5
KEY2 DATA7
KEY2 DATA5
KEY2 DATA6
KEY2 DATA8
KEY3 DATA10
KEY3 DATA11
KEY3 DATA12
KEY3 DATA13
KEY3 DATA15
KEY3 DATA16
KEY3 DATA17
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,4))
OPTION COPY
OUTFIL INCLUDE=(81,8,ZD,LE,3),BUILD=(1,80)
|
|
|
Back to top |
|
|
JayC
New User
Joined: 27 Sep 2008 Posts: 70
|
|
|
|
arcvns wrote: |
JayC,
That shows you are using SYNCSORT and not DFSORT. |
So, your saying that I am invoking SYNCSORT, even though I am using EXEC=ICETOOL. ? How else do I invoke DFSORT ?
I am sure my shop is allowing me to use ICETOOL command because I ran a few sorts using VERIFY etc... |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
JayC,
Quote: |
So, your saying that I am invoking SYNCSORT, even though I am using EXEC=ICETOOL. ? |
Yes. Exactly. By doing so you're really invoking Syncsort's SYNCTOOL.
Quote: |
How else do I invoke DFSORT ? |
Unless your shop has installed DFSORT, you can't do that. Normally each shop has either of these products and not both.
Quote: |
I am sure my shop is allowing me to use ICETOOL command because I ran a few sorts using VERIFY etc |
It's not only for you, but for everybody who uses SYNCTOOL, coz Syncsort has kept an alias name "ICETOOL" for SYNCTOOL.
If you search the forum, you'll find more topics explaining the difference between the various sort products. |
|
Back to top |
|
|
JayC
New User
Joined: 27 Sep 2008 Posts: 70
|
|
|
|
Thanks for the clarification arcvns |
|
Back to top |
|
|
|