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
 

 

Add sequence number and increment it for matched records

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

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Fri Dec 21, 2007 12:25 pm    Post subject: Add sequence number and increment it for matched records
Reply with quote

Hi,

My input file is as below.

123456 AAA 1A
123527 AAA 1A
123527 AAA 1A
123527 AAA 1B
123527 AAA 1C
123527 BBB 2A
123527 BBB 2B
123527 CCC 1A

I want the output file as below

1 123456 AAA 1A
1 123527 AAA 1A
2 123527 AAA 1A
3 123527 AAA 1B
1 123527 BBB 2A
2 123527 BBB 2B
1 123527 CCC 1A

If first 10 characters are matched then only I want to increment the seqnum other wise it has to restart

Thank you
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Dec 21, 2007 1:37 pm    Post subject:
Reply with quote

Prabha

Try this DFSORT solution
Code:
//*******************************************************
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
123456 AAA 1A                                           
123527 AAA 1A                                           
123527 AAA 1A                                           
123527 AAA 1B                                           
123527 AAA 1C                                           
123527 BBB 2A                                           
123527 BBB 2B                                           
123527 CCC 1A                                           
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC BUILD=(SEQNUM,1,ZD,RESTART=(1,10),3:1,78)       
/*                                                       
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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