Multi formatted fixed width file

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Multi formatted fixed width file

Post by jdmiceli »

Hi all,

I have a requirement to generate a multi formated fixed width file from two different formatted files.

Source file 1:
Field1(3) Field2(8) Field3(10) Field4(2) Field5 (2) Field6(5)
POL 20061031 2345623SQ 10 re 25367
Source file 2:
Field1(3) Field2 (10) Field3(2) Field4(8) Field5(4) Field6(5)
INS abcdefghdd 10 agaiskod dtdyt

Target file should look like:

POL200610312345623SQ10re25367
INSabcdefghddagaiskod dtdyt

Note:Source file 1.Field4 and source file2.field3 are key fields.
Source files are initially generated from SQL Server tables.

Any solution for my query will be really helpfull for me.

Thank you in advace.


Regards
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

And the requirement is to use DataStage TX maps?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Multi formatted fixed width file

Post by jdmiceli »

Yes, I have to create the target file through Datastage maps.

Is this possible?

-Regards.
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I don't know, since TX is not my area of expertise. Certainly regular DS jobs could do it. I would imagine that you could separate processing into two streams, one for each format, and bring them together at the end (maybe by writing stream 2 into a temporary file and using an O/S command like cat to append it to the "real" output file).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jvmerc
Participant
Posts: 94
Joined: Tue Dec 02, 2003 12:57 pm

Post by jvmerc »

Do your records need to appear is a specific order; POL, INS, POL, INS and so on or can it be POL, POL, POL, INS...... ?

Can you bypass the files and extract your data directly from the tables?
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Post by jdmiceli »

jvmerc wrote:Do your records need to appear is a specific order; POL, INS, POL, INS and so on or can it be POL, POL, POL, INS...... ?

Can you bypass the files and extract your data directly from the tables?
I'm working on normal Datastage server edition not the Datastage TX.
I appologize for the confusion.

It is not madatory to exract data to files and then to TGT file. I can also extract data directly from tables.

Also the order of the records should be
POL
INS
POL
INS


-Regards
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a server job the easiest approach is to build the entire record as a single field (using stage variables as needed). The Fmt() function is useful for right padding. Output metadata is a single VarChar column (since your row lengths are 30 and 32 characters respectively).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Final follow up on this one....

Post by jdmiceli »

ray.wurlod wrote:In a server job the easiest approach is to build the entire record as a single field (using stage variables as needed). The Fmt() function is useful for right padding. Output metadata is a single VarChar column (since your row lengths are 30 and 32 characters respectively).
I appreciate everyone's input on this. They changed the requirements adding a third file as well, so I ended up dealing with Policy, Insured and Vehicle information. The Policy info acts as the driving factor for the other files, and we had to take into account ADD and DEL records for daily processing. The data in the files comes in no order and we have no control over what comes when other than we know the files are related.

Ultimately, due to time constrictions, I chose to write a solution in Perl to combine the files, ordered and grouped by Policy stuff and related records from the other two files by ADD/DEL to create a delimited output file.

Thanks for the input,

Bestest!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
jvmerc
Participant
Posts: 94
Joined: Tue Dec 02, 2003 12:57 pm

Post by jvmerc »

Remeber this is the DSTX forum so to avoid confusion...... :)
Post Reply