User Variable Activities in series

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
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

User Variable Activities in series

Post by banactp »

Hello,

Does anyone know how DataStage executes a series of User Variable Activities (UVAs)?

I'm having a problem wherein a series of three UVAs do not produce the same output values to a subsequent Job Activity from run to run. The first UVA loads some environmental variables via $PROJDEF and then overrides them if the appropriate job parameter is set. For instance the expression for the user variable SOURCE_FILE might be:

Code: Select all

If ( IsNull(ALT_SOURCE_FILE) Or (Len(Trim(ALT_SOURCE_FILE)) < 1) ) Then $Default_Source_File Else Trim(ALT_SOURCE_FILE)
The resulting value for SOURCE_FILE is then passed to a second UVA, where it is used to set another user variable EFF_RUN_DATE, e.g.:

Code: Select all

If ( IsNull(ALT_RUN_DATE) Or (Len(Trim(ALT_RUN_DATE)) < 1) ) Then CustomDateRoutine(FirstUVA.SOURCE_FILE) Else Trim(ALT_RUN_DATE)
Then, finally, EFF_RUN_DATE is passed to a third UVA to set yet another user variable, OUTPUT_FILE, e.g:

Code: Select all

If ( IsNull(ALT_OUT_FILE) Or (Len(Trim(ALT_OUT_FILE)) < 1) ) Then $Default_Output_File_Dir:"/":SecondUVA.EFF_RUN_DATE:".ds" Else Trim(ALT_OUT_FILE)
The last UVA triggers a Job Activity. The problem is that sometimes, it doesn't seem like all of the user variables from the preceeding UVAs are set before the job is triggered. I can see (through a Notification Activity) that the environmental ($) values aren't always being loaded. In other words, it looks like all the user variables in one UVA aren't necessarily set before the next UVA in the series kicks off. Anyone know if this is true?

One workaround that seems to work is to put in a "sleep" Execute Command activity, or a Wait-for-NonExistent-File Activity between the last UVA and the Job Activity. Apparently this will force all the UVAs to finish, and for my sequences it seems like I have to introduce a wait of about 15 seconds to be safe. But I hate to use a kludge like that. Any other ideas on this subject?

Thanks,

Tim
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
does a sequencer stage do the trick as well?
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
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Post by banactp »

roy wrote:Hi,
does a sequencer stage do the trick as well?
Roy,

A single sequencer (after the last UVA but before the Job Activity) does not. Neither does putting a sequencer between each UVA.

I can't hook the UVAs up in parallel to a single sequencer because of the dependencies of the variables within them.

Tim
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

UPDATE

Post by banactp »

Well, the issue does not seem to be dependent on timing... putting in the sleep or wait is not the key. The problem instead seems to be with the way job parameters are being set by environmental variables.

I'm initializing a dozen or so job parameters with environmental values through $PROJDEF. These are user-defined environmental variables BTW, not stuff from the UNIX environment.

It appears that sometimes in my UVAs, instead of picking up the correct value, DataStage initializes these job parameters with either nothing or a value that is displayed as "txtExtended". Then when I pass these values to another Job Activity, that job fails. If I override the default values (as described in my earlier post), the sequence runs just fine.

There does not seem to be any rhyme or reason as to which parameters are being initialized incorrectly. I'm still trying to determine a pattern.

Any ideas/insights/suggestions will be greatly appreciated!

Tim
Post Reply