Basically, I need to take the record from a VB file, insert spaces at a certain location and then write that record to a VB file. All this using SYNCSORT.
Details:
Input File Length: 504 (500 data + 4 RDW)
From this input file, I need to insert 10 spaces starting from 5th data position (i.e. 10th actual column) to 14th data position (i.e. 19th actual column). Luckily, the last 25 columns in the record is FILLER, so need not bother to increase the file length of the new output file. This FILLER region can be used. This modified record must be written to a file of the same record length of 504.
Please do let me know if there are any alternatives to achieve this without using VTOF or FTOV. I need to take the VB file as input and create a VB file output.
Unfortunately, we don't use DFSORT for which I have a lot of documentation with me.
Hi Ekta. I did go through the post, I am still confused. I tried using VLTEST=0, hoping that the records lengths will not be considered but still it gives me the same error which says that OUTREC - SHORT RECORD. I am not familiar with using the PARM options.
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
balimanja, You specified 10,485 in the OUTREC statement. This says that each record must be at least 500 bytes long. While the message WER244A, tells you that one or more of your variable-length records is not that long.
And what about 9th posistion, per your card?
I'm not connected just now -- but it seems you can work around by keeping these things in mind.
Just for try,You may use,
Code:
OUTREC BUILD=(1:1,4,
5:5,4,
10:10X,
20:20)
This says that each record must be at least 16 (am I correct?) bytes long, which I suspect they are.
Thanks Ekta & expat. It seems to be working. But there was one thing that I forgot to mention. This file has a header and trailer.
Header:
Code:
----+----1----+----2----+----3----+----4
H AL0909257563
Trailer:
Code:
----+----1----+----2----+----3----+----4
T 0909250000074508
The header lasts until 14th data column (19th actual column)
As I was trying your suggestions, I noticed that the code was working for only those columns that were within the header.
Code:
Sort fields=copy
outrec fields=(5,4,10X,16:9)
The above code would work only until 15 (actual column) i.e.
Code:
Sort fields=copy
outrec fields=(5,4,10X,16:15)
Beyond this, it would throw an error as I had mentioned above. I have a fair idea to byepass this and satisfy my above requirement of including spaces. But I can't think of doing it without using 3 steps associated with one invocation of SYNCTOOL & TOOLIN statements. Please let me know if there is any way in which I could do it more efficiently.
I will post the method along with the result soon.
Yes Anuj, I realised that the error was because of the header which was the shorter one... I am trying to find a way to byepass this problem i.e. exclude header and trailer while applying the logic that inserts spaces as per the requirement.
Now I have split up the input records, inserted space in them (well it is a little different that what I had initially asked for .)
Here is the TOOLIN for the above CNTL.
Code:
COPY FROM(IN1) USING(LGC1)
Now that all the data are in separate files, I am stuck as to how to merge the Header, 'the Other Type Record', Data records and the Trailer (in the mentioned order). The Final file needs to be sorted as (2,13,CH,A).
Please let me know as to how to merge them together.
Thank you all for your help. I have been able to complete what was needed. A new learning since the file was a VB. Had it been a FB, I guess it wouldn't have caused that much of a problem...