Page 1 of 1

Header/Trailer Insert

Posted: Wed May 27, 2015 8:22 am
by jzajde1
Hello All,

Currently, I am provided with a fixed flat file. The flat file has a header and trailer record. The records which are not the header/trailer need to be packed in the CFF Stage.
- Job design: Seq. File -> Transformer -> Sort -> CFF
- The records are brought in as one column 'A' varchar 1000
- I split the records up based up character position and length.
- I am removing the header/trailer records from the file with a constraint in the Transformer Stage. These records should not be packed.

What is the best way to insert the header/trailer records back into the file output?
Please advise, thank you.

Jared Z.

Posted: Wed May 27, 2015 9:07 am
by arunkumarmm
Write your header and trailer to two different files and use a cat command in the after job subroutine to concatenate the files.

Posted: Wed May 27, 2015 10:50 am
by FranklinE
Jared, I'd like to know more about the seq file. You say it has a header and trailer, but I wonder why you aren't using CFF to read it.

In the meantime, don't drop them. Create header and trailer links out of the transformer and funnel them back between the sort and CFF output stage. Funnel lets you specify the order.

Posted: Wed May 27, 2015 11:33 am
by jzajde1
@FranklinE -

I am not using the CFF to read the source file because there is no delimiter in the source file.
(Besides the header/trailer)
Each record is 400 chars
Header/Trailer are 70 chars

Does this help?
Thank you for the post.

Jared

Posted: Wed May 27, 2015 11:45 am
by FranklinE
Jared, that helps. No second-guessing intended, I just hoped to help.

Parsing each record in the transformer is a good approach, I've used it many times.

Posted: Wed Jun 10, 2015 3:13 pm
by jzajde1
All -

I wrote the header/trailer records to separate files.

Then I wrote a bash script and created a subroutine which 'cat's' all of the files together.

Thanks,

Jared