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

Duplicate records in sequence


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Fri Jun 18, 2010 3:30 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Jun 18, 2010 7:45 pm
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: 577
Location: USA

PostPosted: Fri Jun 18, 2010 9:15 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top