Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
Hi ALL,
I have a flat file with large no of recs. I want to copy these recs to 2 other files such that first file contains recs till a perticular record and other file contains recs after that perticular rec.
Now, this perticular rec needs to be searched as we don't know its location but we have a search key
How to accomplish this ?
--Parag
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Is the search key a character value? What's the length? Is it always the same value or does it change from run to run? Please give an example of the search key value.
Do you want the record with the search key in the first output file or in the second output file?
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
Hi Frank,
Here is an example of my Input and Output files
Input File
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
abcd111122223333 ---- normal rec
DATE=03012007 ----------------------------Specical Rec (Date)
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec
efgh111122223333 ---- normal rec
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes. For more information on this group technique, see the "Include or omit groups of records" Smart DFSORT Trick at: