Job Sequencer : arguments value expression syntax allowed

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
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Job Sequencer : arguments value expression syntax allowed

Post by luca »

Hi there !

I have noticed a few strange behavior while building job sequence and would like to have some advice on the right use of routine and job activity parameters:

1/ in the job sequence, I have a job activity, for which I want to assign parameters coming from the result of a previous routine. When I get the syntax RoutineActivityName.$ReturnValue from the menu, it works fine, but as soon as i try to edit this box, even if no change is maid, I got a warning when clicking OK: "Job parameter names must begin with an alphabetic character and consist of alpha-numerics and underscores only. If you wish to use a litteral value, these must be quoted (")." (Parameter Editor).
It is not allowed here to build the paramter by concatening the result of a routine and a string ?

2/ The previous works for a routine activity: I have 2 routine activities, the second one is using the result of the first one to which I have managed to concatenate a predefine string. syntax I have used: RoutineActivityName.$ReturnValue:"-01"

As this doesn't work in a job activity, I wonder if it is safe.

I would appreciate if you can clarify the appropriate use of value expression for routine activity and job activity.

Thanks.

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

Post by ray.wurlod »

You will probably resolve this yourself when you inspect the job control code generated by compiling the job sequence. "$ReturnValue" is just a place-holder - it's a way for the GUI to flag that what is wanted is a variable whose name is generated at compile time.
The rules for DataStage BASIC do not allow variable names to begin with "$", which is why you're getting this message.
If you really do want to change what DataStage Designer has done, copy paste the job control code into a server job, and edit it there (as you learned in Mumbai).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

Thanks for your replay Ray,
Even if I know how to do what you suggest, most of the time I prefer to keep the original job sequencer because I prefer to keep the graphical advantage of the sequencer.
I prefer to go for adding a routine to perform the calculation I need.
Have a nice week-end.
Where are you at the moment?
Lu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In Bangkok (Thailand) at the moment. Where are you?
If you want to preserve the job scheduler and yet perform this edit, you need to compile before editing, then inspect the code to see what the name of the variable actually is.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

Hi Ray, thanks for your time. Sorry for the late answer, this is due to having to leave for a long week-end (I am now in the UK and for this assignements I have got a 2 days and a half week-end, much better than India ...).
I have had a look at the code generated and this let me thinks it is fine to concatenate a string after the RoutineActivityName.$ReturnValue. What I still don't understand is why it is not allowed in the sequencer GUI for a Job Activity, it is a pity having to do it in the code instead of being able to do it in the graphical design.
Don't you agree?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It stems from the fact that, when code is generated, variable names are generated. This is particularly important when "marked" items (such as return value, but also names of routines and the like) have to be incorporated. Mapping variable names also supports the ability for the Japanese version of DataStage, for example, to have stages, routines and so on named in local language, even though DataStage BASIC requires identifiers to be strictly ASCII.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
in order fot any return value/user status/jobstatus
you want to use in a sequencer job after it was run you need to be in a point that has a link connecting to that stage.
i.e. Routine Activity AA -> link -> Routine Activity BB
in this way routine BB can use routine activity's AA return value etc.

this will work with no manual change of the code generated via the sequencer GUI code.

IHTH.
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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, but can you manipulate the value, for example by concatenating a string value, as luca wants to do? I don't think it can be done in the GUI.
But I would be happy to learn - how would you refer, in your example, to Routine AA's return value when you are in Routine BB? Pass it as an argument?
Unfortunately I don't have DataStage available at the moment, otherwise I'd test it myself!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

Ray,
the answer to your question is yes.
I have done the following:
I have 2 routines with a link betwee. The parameter of the 2nd routine is the value returned by the first routine, concatenated to a string. It works in a routine activity.
But it is not allowed (by the GUI) in a job activity.
(At least for DS 6.0)
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
in this way you can use the BB routine to simply concatenates argumnets to a string and return that to have your new ready for use job parameter :wink:
clumsy perhaps but more important no intervention with the generated basic code and keeps everything out in the open for all to see 8)

IHTH
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
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

Hi !

roy, what do you mean by the BB routine ?

FYI I got an answer from DS support.
They advise to use routines (even if you end up with a lot of them) rather than coding something that you could not have generated by simply using the GUI.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DS support answer:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For the 1/, no, this is not allowed, simply because this case is not
managed to use a modification of this parameter cause we suppose that the
routine handle this. You need to know that this is due to "source"
generation and if we modify the value, we alter the signification of it.
For the moment, the job sequencer is not "intelligent" enough.
As far as I know, modifying this will cause the process to be too much
complicated and as a job is a UniVerse BASIC source generator and the job
sequencer is a job control generator so 2 sequenced generator, this is
enough complex.

2/ No this is not really safe, as this is always possible in another way :
modify the routine in order to add a parameter for the "-01" and let the
routine perform the stuff, in order to avoid having complex code
generation in the job sequencer which is complicated enough.

So in order to summarize : avoid modifying parameters in job sequencer,
prefer do it in "routine" as you have access to the routine and not in the
basic code generated by the job sequencer.
In other word : Job Sequencer exist to have graphical representation of
basic code, do not try to insert special code in it that have no graphical
representations such as parameter modification.
May be do I need to raise an enhancement to have another job sequencer
stage that should named : variable editor ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
well I only ment AA to be the first routine and BB the second.
also I figgured that would be the official response you'll get.

the BB routine would get the return value from the first 1 and concatenate something to it (hard coded string or another argument or what ever) then you can pass the BB routine's return value as a whole (which would be complete) to your job
IHTH
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
Post Reply