DS functions as Stage Variables

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
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

DS functions as Stage Variables

Post by I_Server_Whale »

Hi All,

Can we assign DS functions like DSAttachJob, DSGetLinkInfo, DSGetJobInfo, etc to Stage Variables? I'm trying to assign but the Stage Variable derivation always stays RED.

Any idea why this is happening? Any help is very much appreciated.

Thanks,

Naveen.

Code: Select all


DSAttachJob(SVR_LOAD_POS, DSJ.ERRNONE) is assigned as 'StageVar1'

Code: Select all

DSGetLinkInfo(SVR_LOAD_POS,"Transformer_3", "DSLink4", DSJ.LINKROWCOUNT)

is assigned as 'StageVar'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? This doesn't really make any sense. What are you trying to accomplish?

This kind of thing would typically be done in a custom routine and then (possibly) call the routine in the derivation of a stage variable.
-craig

"You can never have too many knives" -- Logan Nine Fingers
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Hi Craig,

I have a bunch of jobs for a process. I have sequenced these jobs in a sequencer. The first two jobs access two different tables from MS-SQL server. So, normally the process finishes creating the output flat-file with a Date and TimeStamp in the output filename.

For example,

MBR_ENR_20050914103045.dat (MBR_ENR_YYYYMMDDHHMISS.dat)

If either of the table has the required data, the output file has the regular processed data. But if both the tables have no required data, then I should create the same output file in the above format, but with this text "NO DATA TODAY" in it.

So, for achieving this, I thought I would access the row counts of the first two jobs ( the ones which access the table through ODBC). Using these row counts in the stage variables of the job where I create the output file with the date and timestamp, I'm thinking that i could hard code "NO DATA TODAY" into the output file.

That is the whole reason behind it. Please let me know your valuable opinions and suggestions. Thanks much,

Naveen.
RodBarnes
Charter Member
Charter Member
Posts: 182
Joined: Fri Mar 18, 2005 2:10 pm

Post by RodBarnes »

You cannot use these routines in this fashion. DSAttachJob requires passing of a job NAME while DSGetLinkInfo requirs passing a job HANDLE. I think what you want to do is this:

DSGetLinkInfo(DSJ.ME, "Transformer_3", "DSLink4", DSJ.LINKROWCOUNT)

DSJ.ME is an internal variable that carries the handle to the current job. Doing this should return the number of links into your stage variable.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Easy to do in a custom routine or in a shell script. In a BASIC routine you open the file, read the first line, if there is no data to be found then you write out your "DO DATA TODAY" and close it. Call it from a sequence job via a routine stage that follows the job activity stages.
Post Reply