order id is changing

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
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

order id is changing

Post by bobby »

hi,
can u please guide me
i have in my source order id previous_orderid original_order_id
51411 - -
51428 51411 51411
51432 51411 51411
this record comes as 1 record i want my curr_flg be 1 on last order id thats 51432
please guide me i am in fix do i have to write some kind of subquery
Thanxs
bobby
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

A quick and dirty way to do this is to make two passes through your file.

Pass 1:

Build a hash file whose primary key is original order id, and its data column is max order id.

Hash
|
| Lookup original order id
V
Seq -----------------> Transform --------------------> Same Hash File

If order id > max order id
from lookup
then update hash row

Pass 2:

Read you file, lookup original order id. If this order id = max order id from lookup, the current indicate is 1 else 0.
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

hash file warning

Post by bobby »

Hi Chuck
when i am writing my original id to hash file as some rows are blank ---
so its giving me error HSHSWWATORDER..Hashed_File_1.DSLink2: ds_uvput() - Write failed for record id '<Missing or NULL>' as i am making orginal id as primary key in hash so should i ignore that error
Thanks,
bobby
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Is it working now?
Post Reply