Generate Sequential file Fixed format
Moderators: chulett, rschirm, roy
Generate Sequential file Fixed format
Hi everybody
I need to generate sequential file with a fixed format.
Do you have any idea how can I do it ?
Regards.
I need to generate sequential file with a fixed format.
Do you have any idea how can I do it ?
Regards.
mrekik,
you mean a fixed-length format? If you use the sequential file stage and specifically remove the attributes for terminator, separator and quotes and add the null-padding then you will get a fixed-length output file.
Another possibility is to pipe the Px output file to the input file of a Server job, where it is much easier to specify a fixed-width output.
you mean a fixed-length format? If you use the sequential file stage and specifically remove the attributes for terminator, separator and quotes and add the null-padding then you will get a fixed-length output file.
Another possibility is to pipe the Px output file to the input file of a Server job, where it is much easier to specify a fixed-width output.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
How about reading it in with a " " (space) as the separator and no quotes, then writing it out as a comma-delimited, quoted file? You don't even need a transform.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
mrekik,
please re-read your initial post, it states
2. If you specify a TRANsform stage and do a simple TRIM() function on each padded CHAR field and write it to a sequential file defined with double-quote quote characters and a comma separator and default line termination you will end up with what you need.
If it doesn't work, please tell us whether the issue is with reading or writing. You can debug the read with a peek stage and the write with your favorite editor on UNIX.
please re-read your initial post, it states
1. Does your source file actually contain the double-quote " characters, even though it is fixed-length? I will assume that you can now read this file correctly, using sequential file fixed length file definitions.I need to generate sequential file with a fixed format.
2. If you specify a TRANsform stage and do a simple TRIM() function on each padded CHAR field and write it to a sequential file defined with double-quote quote characters and a comma separator and default line termination you will end up with what you need.
If it doesn't work, please tell us whether the issue is with reading or writing. You can debug the read with a peek stage and the write with your favorite editor on UNIX.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Thank you for your response
I agree with you that my initial need was generating fixed format sequential file. Now, I am able to do it using a server job.
My second question was how to generate a non fixed format without space padding from a fixed format file. Using a transform stage to erase space padding is a good idea but my file contains 300 fields and it supposes that I must apply the trim() function to the 300 fields one by one ...
Is there another manner to do the same thing at the stage level, not at the fields level.
Regards
I agree with you that my initial need was generating fixed format sequential file. Now, I am able to do it using a server job.
My second question was how to generate a non fixed format without space padding from a fixed format file. Using a transform stage to erase space padding is a good idea but my file contains 300 fields and it supposes that I must apply the trim() function to the 300 fields one by one ...
Is there another manner to do the same thing at the stage level, not at the fields level.
Regards
mrekik,
with 300 fields that would be a lot of work; but I think you might be able to do it without an explicit trim, depending on the data types (whether CHAR or VARCHAR) and the implicit trim when writing to a delimited output might work [test it to see]. If not, a server job which declares the whole row to be just one column will let you do a single TRIM function.
with 300 fields that would be a lot of work; but I think you might be able to do it without an explicit trim, depending on the data types (whether CHAR or VARCHAR) and the implicit trim when writing to a delimited output might work [test it to see]. If not, a server job which declares the whole row to be just one column will let you do a single TRIM function.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It's easy (version 7.5) to propagate the Trim() function across all columns in the Transformer stage. Right mouse click and choose propagate expression, then fill in Trim($1) and select "entire expression".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.