SEETING CURRENT FLAG

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

SEETING CURRENT FLAG

Post by bobby »

Hi Frnds
i have my job id i want curr_flg on latest one as 1 and rest o

JOB_ID curr_flg
--------------------
HS2004129319142-1 0
HS2004129319142-1 1
please advise
thanks
bobby
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
you'll need to give more info.
for example do you rebuild the entire target every time?
if not how do you intend to change old rows with 1 flag to 0?

there are some trick fo doing this, one is to write a hash file with dummy key column that is 1 and the actual ID of your file as none key coolumn; this will result with a 1 column hash file with the latest row's ID
after you have this you can process the info and perform a lookup on this hash, when lookup is hard coded 1, eventually putting 1 in the flag where the row key column = the column from the lookup hash file.

another way could be getting the @INROWNUM of the source data before processing it and passing it as a parameter to your job, then in the transformer put something like :

Code: Select all

If @INROWNUM = P_IN_ROW_NUM Then 1 Else 0
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

Post by bobby »

HI ROY,
well no i want to keep record of previous id ,
Thanks
Bobby
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

Post by bobby »

hi
i am using source and target as oracle
as oer req i have to do like this
end_dt if job_id exist in the table set set the current inserted record to a future date 1/1/2500 ,retrieve the last archive record and set date to system date

curr_flg
if job_id exists in this table set the current inserted record to1 ,reterive the last active record with curr_flg =1 and reset to 0
dt_changed
if this is a first insert to the table then set to system date if updating an existing record then set this to system date
thanks
bobby
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

bobby

While posting give us the full information with examples of what is your source and how you want your target to be.

Thanks
Siva
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The solution will most likely involve stage variables, and require that your input be sorted.
Read about stage variables in the DataStage manuals.

Alternate solutions exist, involving Routines and variables declared to be in a COMMON area in memory. The RowProc category of SDK routines make use of this technique. Were you even aware that one of these is called RowProcCompareWithPreviousValue, which sounds exactly like what you want to do?

Spend some time researching what you don't need to reinvent, so as to become a more productive developer. This includes components supplied with DataStage as well as components already developed in-house, and components obtained from here and from Ascential Developer Network.

If all else fails you can hire consultants to do your development work to your specifications. Maybe even to translate those into "proper" English!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply