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

Add sequence number and increment it for matched records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top