DSSetParam

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
SonShe
Premium Member
Premium Member
Posts: 65
Joined: Mon Aug 09, 2004 1:48 pm

DSSetParam

Post by SonShe »

I have the following server routine running as Before-job subroutine. I have job parameter "FILE" that needs to be set in the routine. The default value in the job properties for the parameter is "XXXX".

When I run the job I can see from the log that this subroutine is working and correctly setting the value as can be seen from the output of the DSLogInfo function. However, when I am writing the value of "FILE" to a sequential file I see the default value, not the value set in the routine.

I would appreciate any help in this one.

Thanks.


$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

SeeComInvFile = "N" : Oconv(Oconv(date(),"DYMD[4,2,2]"),"MCN") : InputArg
ErrCode = DSSetParam(DSJ.ME, "FILE",SeeComInvFile)
Call DSLogInfo(SeeComInvFile,"SetParm")

ErrorCode = 0 ;* set this to non-zero to stop the stage/job
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You absolutely cannot do this in a supported manner. You cannot change a job parameter value from within a the job itself during runtime. You must use a controlling job, such as a Batch or Sequencer, to set dynamic values at runtime.

There are methods to change a parameter value during a jobs execution, however, it uses internal, undocumented, and upsupported hacks.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
SonShe
Premium Member
Premium Member
Posts: 65
Joined: Mon Aug 09, 2004 1:48 pm

Post by SonShe »

kcbland wrote:You absolutely cannot do this in a supported manner. You cannot change a job parameter value from within a the job itself during runtime. You must use a controlling job, such as a Batch or Sequencer, to set dynamic values at runtime.

There are methods to change a parameter value during a jobs execution, however, it uses internal, undocumented, and upsupported hacks.
Ken,

This time I created a sequencer and have routineActivity stage followed by the job. In the RoutineActivity stage, I have calling the routine with the following codes:

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF


jHandle = DSAttachJob("DateConv3",DSJ.ERRWARN)

SeeComInvFile = "N" : Oconv(Oconv(date(),"DYMD[4,2,2]"),"MCN") : InputArg
ErrCode = DSSetParam(jHandle, "FILE",SeeComInvFile)
Call DSLogInfo(SeeComInvFile,"SetParm")

ErrCode = DSDetachJob(jHandle)
ErrorCode = 0

As I mentioned earlier, I could see the new value being set. However, I still keep getting the default value for the Job parameter.

I will appreciate if you can please tell what I am doing wrong and I should do to accomplish this.

Thanks a lot.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Here's what you are doing:

You are attaching to a job, which gives you exclusive access to run a job. Then, you are setting the parameter value. Then, you are detaching the job. In essence, you have done nothing.

If you were to have RAN the job after setting the parameter value, it would have used those values. Because you didn't, the job is released. When your sequencer runs the job, it feeds a parameter value to the job, overriding the default, unless you gave it the default value as well.

What you need to do is have the routine activity return a code and pass that result into the job activity stage as a value for the parameter in question.

I don't use the Sequencer, for many reasons. You'll have to have others help you get this working.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
SonShe
Premium Member
Premium Member
Posts: 65
Joined: Mon Aug 09, 2004 1:48 pm

Post by SonShe »

Ken,

I did the way you suggested and it works. I did not have to use DSSetParam at all. I am wondering how that function works. If using batch control there is absolutely no problem in getting DSSetParam to work. However, if I am using sequencer then I would like to know if DSSetParam can be used at all and if yes, how does this work.

I will appreciate if any one can help me understand this.

Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A job sequencer is nothing more than a graphical user interface to writing job control code - you can view the job control code in the job properties window, and note there that it does use DSSetParam to set parameter values.

However, in a job sequence, the code is read-only, so that alignment between the graphical design and generated code can not be disrupted.

The approved method for setting a parameter value in a job activity is to select the job parameter from the job sequence's parameters, from some earlier activity, from the controlled job's default value, or using an explicit (string) value. You don't have to code anything; appropriate code will be generated.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply