second file having LRECL = 31
First File having LRECL = 166
What happening in the output is as follows:
Output LRECL = 200
Second file data is displaying for the first 31 bytes - that is fine with me
First File data having 166 bytes of data. In that, first 31 bytes displaying at the end of the output file(from 167 to 197th position) but it is supposed to display from 32nd position in the output file, hence i am not getting the format I required.
Remaining data should display after this.
Only Problem I am facing first file data that to 31 bytes, it was supposed to display from 32 position , displaying from 167 position.
I know I made some mistakes in declaring OUTREC fields, but I am not getting what is the mistake i have done.
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
This is how we redefined the shorter records yesterday, and your code does not look like what is coded here.
Quote:
I think it may have to do with the 115 byte record. It looks as though your OUTREC may be incorrect.
The code below is coded from memory so may need a little tweak, but this is how I see it-
1,115 = original 115 byte record
385X = 385 spaces to build up to 500 bytes
1,115 = append original record after spaces
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
Take avery close look at what we did on Tuesday.
With the shorter record we added the correct number of blanks to make the record length the same as the longer record, and then what did we do with the original shorter record ?
And for the longer record what did we do, we did not take the first 31 bytes of this record and stick it on the end .................... did we ? SO what did we put on the end of this record ?
IF the first file is longer than second file, then we can adjust the second file, hence data format would be fine.
But now in the second scenario, first file having lesser compared to first one. Hence not getting the format I required.
If I match second file length by comparing first file, here it won't work and even I can't give Banks here as you know second file containing full 166 bytes of data, but some how not getting the format I REquired.
Output file conatining 200 Bytes....
in the out file - getting data format as below:
1-31, 31 bytes from second file
32-166, first file data starting from 32nd byte
167-197, first file data starting from 1st byte
What I need is ...
1-31, 31 bytes from second file
32-197, first file data starting from 1st byte
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
FILE2 - Increase from 31 to 31 + 166 BLANKS.
FILE1 - Pos 1-6, the key, leave as is, BLANKS in pos 7 - 31, pos 32 = 166 bytes of original FILE1 record.
Not sure if the order of the records in T1 can affect the result, but I would try by swapping the order in which the records are written to T1, doing the shorter ones first. May not affect it, let me know what happens.
FILE1 - Pos 1-6, the key, leave as is, BLANKS in pos 7 - 31, pos 32 = 166 bytes of original FILE1 record.
------------------
FILE2 - Increase from 31 to 31 + 166 BLANKS. - this is fine
FILE1 - Contains all 166 bytes of original FILE1 record, hence i speicify Blanks from 7-31, then in the output it displays Blanks and loosing 25 bytes of data