BASIC routine -> Parallel routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
rmrama
Participant
Posts: 26
Joined: Wed Oct 15, 2003 1:39 am

BASIC routine -> Parallel routine

Post by rmrama »

Hello,

I have a routine performing the following in Server.


* Declare shared memory storage.
Deffun SKGenerator(A) Calling "DSU.SKGenerator"
Common /ARLookupW/ ARLU, ARFile

EQUATE RoutineName TO 'ARLookupW'

Open "AR_LU" TO ARFile Else Ans = -1

* Read the named record from the file.

If Len(SYS_ID_TP)=3 Then SYS_ID_TP=SYS_ID_TP:" "
Else If Len(SYS_ID_TP)=2 Then SYS_ID_TP=SYS_ID_TP:" "
Else If Len(SYS_ID_TP)=1 Then SYS_ID_TP=SYS_ID_TP:" "
Else SYS_ID_TP=SYS_ID_TP
Flg="O"
Read ARLU From ARFile, SYSNAME:@TM:SYS_ID_TP:@TM:SYS_ID
Else
If FLG="Y" Then
ARLU=SKGenerator("AR1")
Write ARLU To ARFile, SYSNAME:@TM:SYS_ID_TP:@TM:SYS_ID
Else
Ans=-1
End
Flg="N"
End
Else ARLU=0
End

Ans = Flg:ARLU

This routine looks for and retrieves a key in a hash file. If not found, the routine generates and writes back the key into the same hash before returning value.

Can a similar functionality can be created as a Parallel routine? Are there any other ways of doing the same?

Thanks in advance for your time, gurus!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A parallel routine would need to be written in C++, and you would need to figure out some way to mimic a key-based write to some kind of structure (hashed files not being directly available). But, theoretically, it's do-able.

You might consider investigating the Surrogate Key Generator stage in parallel jobs (7.5 and later), or the SCD2 stage in the next release, before embarking on your own idiosyncratic path.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pneumalin
Premium Member
Premium Member
Posts: 125
Joined: Sat May 07, 2005 6:32 am

Post by pneumalin »

As Ray advised, the SurrogateKey stage should serve the same purpose with your Basic Routine. If you want to migrate it to PX, following my post in "CRC320..." might give you some ideas.
Post Reply