Add Records dynamically to sequential file in column wise

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
prabudsx
Participant
Posts: 14
Joined: Tue Dec 07, 2010 12:14 pm

Add Records dynamically to sequential file in column wise

Post by prabudsx »

Add Records dynamically to sequential file in column wise.

Scenario:

Source:
Field1 Field2 Field3 Field4
UKI1 1 M 2D
UKI2 2 K 4E
UKI2 3 T 7U
UKI3 2 L 2D
UK1 4 S 2A



Target

File1: UK1
-----------
1 4
M S
2D 2A


File2: UKI2
------------
2 3
K T
4E 7U

File3:UKI3
-----------
2
L
2D


Could someone assist how to achieve the above Scenario in Server Jobs?

Note:
------
1) Need to create file dynamically based on first field from source.
2) Any new records arrives with the same value of first field, i have to update the respective file in column wise as mentioned above.
3) Need to create o/p files dynamically based on the unique values of field1 in source.

Your help is much appreciated.....!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For 1 & 3 you can use a Folder stage to write out the records to dynamic files based on a key column. Not sure what #2 means as there are no "updates" to sequential files.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prabudsx
Participant
Posts: 14
Joined: Tue Dec 07, 2010 12:14 pm

Add Records dynamically to sequential file in column wise

Post by prabudsx »

chulett wrote:For 1 & 3 you can use a Folder stage to write out the records to dynamic files based on a key column. Not sure what #2 means as there are no "updates" to sequential files. ...
#2...
If new records arrives in the source for the 2nd run , the requirement is to add to record to the existing o/p file based on the Field1.

e.g.,

New Source:

UKI1 6 H 7R
UKI2 9 Z 2M

Target

File1: UK1
-----------
1 4 6
M S H
2D 2A 7R

File2: UKI2
------------
2 3 9
K T Z
4E 7U 2M

Note:
-----
1) Append the new records to the existing file on column wise
2) If new Field1 arrives, then new file needs to be ceated.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, there's no "updating" of a sequential file. You'll need to join the two files and based on that decide if a record is new or needs to be changed before writing.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply