Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort first 3 records from each Section of the input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort first 3 records from each Section of the input file
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    Post subject: Reply to: Section
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

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    Post subject:
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: 2285
Location: @my desk

PostPosted: Thu Nov 13, 2008 6:02 pm    Post subject:
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    Post subject:
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: 2285
Location: @my desk

PostPosted: Thu Nov 13, 2008 6:18 pm    Post subject:
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    Post subject:
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: 2285
Location: @my desk

PostPosted: Thu Nov 13, 2008 7:10 pm    Post subject:
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: 2285
Location: @my desk

PostPosted: Thu Nov 13, 2008 7:24 pm    Post subject:
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    Post subject:
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: 2285
Location: @my desk

PostPosted: Fri Nov 14, 2008 12:03 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us