It's one to one mapping.
1st record from File1 is added to 21st postion of 1st record in File2,
2nd record from File1 is added to 21st postion of 2nd record in File2, and so on ...
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I've just "hacked" this from another solution. Not tested, but at least close.
You use JOINKEYS with JNFnCNTL files. In the JNFnCNTLs you add a sequence number to the end of each record (I'm assuming they are fixed-length). Then you do the JOINKEYS on the sequence numbers. The REFORMAT sets up your output record, which needs no further changing, as the sequence numbers need not be included on it.
The SORTED and NOSEQCK are to save the files being sorted as they are already "in order" on the sequence numbers.
Thanks Bill, I have tried above SORT tip and that works as long as the a new sortout file is created satisfying my requirement. But I do not want a new file to be created, but the File2 to be updated with 10 bytes records from File1 at position (21,10)
Just want to know if that is possible,update File2 rather than create a new output file ? We are just trying to map the records that we received in File1 with the records in File2. Its all a business requirement that we are trying to accompolish !
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Well, I can't see the problem with using a new file and just "pretending" it is the original. That's the way it is usually done, just without the pretence.
If you want to scramble your file, first make sure you back it up. Stick the file 2 dataset name on SORTOUT and let it rip. Any problems you cause are yours and your organisation's/client's. If you look in the DFSORT manual or search here you'll find the advice is to not do this.
I can see no good reason to do this from what you have said.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
techslam wrote:
Thanks Bill, I have tried above SORT tip and that works as long as the a new sortout file is created satisfying my requirement. But I do not want a new file to be created, but the File2 to be updated with 10 bytes records from File1 at position (21,10)
Any help ?
techslam,
For a copy application, you should NOT use the same data set for SORTIN and SORTOUT. For copy, SORTIN reads and SORTOUT writes are done concurrently, so the writes can overlay what you're trying to read. It may work, but it may also fail or give you incorrect output.
For a sort application, you can use the same data set for SORTIN and SORTOUT. For sort, all of the SORTIN records are read before the SORTOUT writes are started, so the writes cannot overlay what you're trying to read. However, we call this a "suicide sort" because if the sort gets some kind of error before the output is complete, you may have partially overlaid the input data set making it unusable. So you should only use the same data set for SORTIN and SORTOUT if you can recover from having the SORTIN data set be unusable (for example, you have a backup of the SORTIN data set, or it's a temporary data set that you can recreate).