Desired output
first 4 chars of 1st record, date of first record and time stamp of 2nd record are pushed to the right of first 2 records and this process should go on for every 2 records.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
@ashokakash
Learn to use the code tags yourself, it saves myself and other moderators from having to do YOUR work for you.
Code:
[code]
Your stuff
goes in here
[/code]
- Pretty easy isn't it.
Learn to start a new thread, posting on the back of a five year old thread which was totally unrelated is just plain idle laziness.
I have put this into the DFSORT section as your previous effort was tagged onto a SORT product question. But hey ho, as YOU HAVE NOT bothered to say which language you would like help in, how the hell can I possibly know, or anyone else that may wish to help you.
So, you need to tell us -
1) A lot more about your request.
2) Which languages or utilities you are looking for a solution with.
3) Some information regarding the RECFM / LRECL of your datasets.
4) Relative positions and lengths of field being manipulated.
5) Any other conditions / checks that may exist.
6) Most important What you have tried so far and the failing results.
Please, learn to help yourself and those that may want to help you, you have been a member of the forum for 12 years now.
I regret the inconvenience. I refined the input/output below. The problem is date and time stamp is split and the date comes in first record and in the 2nd record same position comes the time stamp.
I need SORT utility to get the desired output. Every two records are related and the both must be affixed with first 4 characters of 1st record, 8 chars from position 18 of 1st record and 8 chars from position 18 of 2nd record.
I hope I made my requirement clear. If it is not sufficient, please let me know. Thank you!
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Which SORT product are you using - DFSORT or SYNCSORT - and it's release level.
RECFM / LRECL of the records - as requested above
Positions of the added output fields - as requested above
What you have tried yourself and the failing results
Not having used SORT for ages but you can create an intermediate record by appending the second record to the first, and then working with the newly created record - two passes of the data will be needed I think.
Or you could wait for a suggested possible one pass solution from "one of the better sorts" on the forum
However, until we see what you have already tried ...................................
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
There may be a better way but you could, in three passes:
Add sequence numbers (INREC) and, (OUTREC) for the the groups of 2 records, PUSH the fields from the 1st record into the required positions in both records of the pair.
Sort descending on the sequence numbers and PUSH the timestamp from what is now the first record of a group of two into both records of the pair.
Sort ascending on the sequence number dropping the sequence numbers.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Here is a version of expat's idea above assuming FB/LRECL=80 input/output data. Push the first record onto the second record and then use the 'merged' second record to write two output records with the required fields in OUTFIL