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

Sort first 3 records from each Section of the input file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Wed Nov 12, 2008 10:41 pm
Reply with quote

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 icon_question.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 12, 2008 11:09 pm
Reply with quote

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
View user's profile Send private message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Thu Nov 13, 2008 5:58 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 13, 2008 6:02 pm
Reply with quote

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
View user's profile Send private message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Thu Nov 13, 2008 6:13 pm
Reply with quote

Hi ,
Sorry for the confusion i made ,we have only the older version of Synsort(2005). Is it achievable with this?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 13, 2008 6:18 pm
Reply with quote

Raghuram,

Check your SYSOUT messages. On the top of the page you'll find the version/release info.
Back to top
View user's profile Send private message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Thu Nov 13, 2008 7:03 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 13, 2008 7:10 pm
Reply with quote

JayC,

That shows you are using SYNCSORT and not DFSORT.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 13, 2008 7:24 pm
Reply with quote

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
View user's profile Send private message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Thu Nov 13, 2008 11:39 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 14, 2008 12:03 am
Reply with quote

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
View user's profile Send private message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Fri Nov 14, 2008 12:10 am
Reply with quote

Thanks for the clarification arcvns
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 Help with SORT - I need to validate d... DFSORT/ICETOOL 0
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
Search our Forums:

Back to Top