Header/Trailer Insert

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jzajde1
Premium Member
Premium Member
Posts: 21
Joined: Wed Jan 07, 2015 8:10 am

Header/Trailer Insert

Post 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.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post 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.
Arun
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post 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.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
jzajde1
Premium Member
Premium Member
Posts: 21
Joined: Wed Jan 07, 2015 8:10 am

Post 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
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post 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.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
jzajde1
Premium Member
Premium Member
Posts: 21
Joined: Wed Jan 07, 2015 8:10 am

Post 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
Post Reply