Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Duplicate records in sequence

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Fri Jun 18, 2010 3:28 pm    Post subject: Duplicate records in sequence
Reply with quote

Hello

Need help on the below.
Want to sort the input file on key filed-1 to give output file as below.

field-1 = 9(3)
filed-2 = x(3)
filed-3 = x(3)

Input file:
======
field-1 field-2 filed-3
==== ==== =====
100 abc xyz
300 bcd xyp
200 dbf xyn
100 adb xtp
150 dfg fsd


Required Output file:
=============
field-1 field-2 filed-3
==== ==== =====
100 abc xyz
100 adb xtp
300 bcd xyp
200 dbf xyn
150 dfg fsd

Regards
Binaya
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jun 18, 2010 3:30 pm    Post subject:
Reply with quote

What do you need help with. What are the rules of the required sort.
What have you tried so far and what is it that is giving you problems.

You say that you want to sort on field 1 but your shown output is not consistent with your request.
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Fri Jun 18, 2010 4:59 pm    Post subject:
Reply with quote

expat wrote:
What do you need help with. What are the rules of the required sort.
What have you tried so far and what is it that is giving you problems.

You say that you want to sort on field 1 but your shown output is not consistent with your request.


I need records with same key to be in sequence without disturbing other records. Of course other records will shift the row position.

In my request 1'st and 4'th record have the same key.
So these 2 records should be in sequence in the output.

This can be done by tables & search in COBOL but don't have any clues if this can be by SORT.

Thanks
Binaya
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 18, 2010 7:45 pm    Post subject:
Reply with quote

Hello,

Show a more comprehensive set of test data (both more records and more kinds of duplication/triplication). It may help if you get rid of the alphabet soup and use something easier to relate to.

Clearly explain the rules for the grouping of the output. As your example shows, it is not in any sort key sequence.

Use the Code tag to preserve alignment and improve readability.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jun 18, 2010 9:15 pm    Post subject:
Reply with quote

Binaya,

assuming 80 byte input file.

Code:
//STEP0100 EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD *                                                         
100 ABC XYZ                                                             
300 BCD XYP                                                             
200 DBF XYN                                                             
100 ADB XTP                                                             
150 DFG FSD                                                             
//TOOLIN   DD *                                                         
  SORT FROM(IN) TO(T1) USING(CTL1)                                     
  SORT FROM(T1) TO(OUT) USING(CTL2)                                     
//T1       DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)   
//OUT       DD SYSOUT=*                                                 
//CTL1CNTL DD *                                                         
 INREC OVERLAY=(81:SEQNUM,8,ZD)                                         
 SORT FIELDS=(1,3,ZD,A)                                                 
 OUTREC OVERLAY=(91:SEQNUM,8,ZD,RESTART=(1,3))                         
 OUTFIL IFTHEN=(WHEN=GROUP,BEGIN=(91,08,ZD,EQ,1),PUSH=(91:81,8))       
/*                                                                     
//CTL2CNTL DD *           
  OPTION EQUALS                                             
  SORT FIELDS=(91,08,ZD,A)                                             
  OUTREC BUILD=(1,80)                                                   
/*                                                                     


Thanks,
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us