Page 1 of 1

Change param values from within a job

Posted: Mon Jul 23, 2007 7:22 am
by ivannavi
I know it's not recommended, it's not documented and future versions will not support this.
BUT,
I'd still like to try.
I have read some topics (there are a few):
viewtopic.php?t=89419&highlight=STAGECOM.JOB.STATUS
viewtopic.php?t=89625&highlight=STAGECOM.JOB.STATUS
viewtopic.php?t=90189&highlight=STAGECOM.JOB.STATUS
viewtopic.php?t=90029&highlight=STAGECOM.JOB.STATUS

and tried to put this, first in a before-job routine and then in the job control:
$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE DSINCLUDE DSD_STAGE.H
$INCLUDE DSINCLUDE DSD.H
$INCLUDE DSINCLUDE DSD_RTSTATUS.H

ErrorCode = 0
ParamName = 'dat'
ParamList = STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES>
Locate(ParamName,ParamList,1;ParamPos) Then
STAGECOM.JOB.STATUS<JOB.PARAM.VALUES,ParamPos> = 'value'
End
The parameter is mentioned in a transformers link derivation and the column is then output to a seq file. But in the file there was a default value, not the one set through code.
The only time I was able to set the value is with before-stage subroutine of a Basic Transformer. But even then this value was not accessible outside of the transformer.
So what is the proper way to perform this "illegal" operation?

Posted: Mon Jul 23, 2007 7:41 am
by chulett
There is no 'proper way' to do something illegal. :wink:

What makes you think you need to do this? Or is this just an academic expedition into DataStage hackerdom?

Posted: Mon Jul 23, 2007 8:08 am
by jeawin
There is a routine around which will let you set a parameter value from within a transform by having the following derivation:

RoutineName(in.ParameterName:"={Parameter value}")
or
RoutineName("{ParameterName}={Parameter value}")
or
RoutineName("{ParameterName}=":StageVariable) etc.

as long as {ParameterName} is a valid parameter name for that job.

It seems to work fine, certainly on Server Edition versions 5, 6, 7.1 and 7.5.

OOPS - Sorry, have just noticed query is for EE - ignore this then. :(

Posted: Mon Jul 23, 2007 9:24 am
by ivannavi
Or is this just an academic expedition into DataStage hackerdom?

It is! I would love to be able to do this! So why don't you tell me if you know how? :P

Posted: Mon Jul 23, 2007 11:22 am
by chulett
Don't know how. Been using the product since the 3.0 days and never had a need to do anything of the sort, so never went over to the Dark Side.

Posted: Mon Jul 23, 2007 8:19 pm
by kduke
viewtopic.php?t=89625&highlight=STAGECOM.JOB.STATUS is my post mostly. It does not work any more. It is a hack but I think it was useful. You can easily do the same thing by writing out the value to a sequential file and reading back in every time you need it.

Posted: Tue Jul 24, 2007 1:03 am
by ivannavi
Thanks Kim!
It does not work any more.
Just to make sure:
This means that parameter values cannot be changed with a hack like this in version 7.5.1.1 (version on my site)?

Posted: Wed Jul 25, 2007 6:47 am
by kduke
Try it and let us know.

Posted: Thu Jul 26, 2007 6:29 am
by ivannavi
I have tried exactly as quoted in my original post. It didn't work. All I ask now is for someone to confirm it was a "valid" try (one that would have worked on some other version). :?