Hi! I'm having trouble with a Flat-file to Flat-file transformation. The source file looks like this (this is a simplified version, the real one has many more records and fields):

Header Record

Name Size
Record Type 2
Company ID 14
Company Type 1
Company Name 150

Income Record

Name Size
Record Type 2
Total Income 15
Tax 15

Retirement Income Record

Name Size
Record Type 2
Total Income 15

Profits Income Record

Name Size
Record Type 2
Total Income 15

And here's what I'd like the output file to be:

Output Income Record

Name Size
Record Type 2
User ID 11
Company ID 14
Company Name 60
Total Income 13
Tax 13

Output Retirement Income Record

Name Size
Record Type 2
User ID 11
Income ID 5
Type 1
Company ID 14
Company Name 60
Total Income 13

Output Profits Income Record

Name Size
Record Type 2
User ID 11
Income ID 5
Type 1
Company ID 14
Company Name 60
Total Income 13

Here's what I'm having trouble with:

  • The fields "Company ID" and "Company Name" from the source file header record should appear in all of the output file record;
  • The "User ID" field that appear in all output records will have the same value in all of them and will be provided by the user;
  • Some fields like "Company ID" have a shorter length in the output file.

How can I accomplish these?

Thanks in advance!