Page 1 of 1

DS functions as Stage Variables

Posted: Wed Sep 14, 2005 11:37 am
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'

Posted: Wed Sep 14, 2005 12:00 pm
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.

Posted: Wed Sep 14, 2005 12:17 pm
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.

Posted: Wed Sep 14, 2005 3:46 pm
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.

Posted: Wed Sep 14, 2005 4:31 pm
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.