DSSetUserStatus in Job

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

DSSetUserStatus in Job

Post by ray.wurlod »

I undertook to advise of a generic way to set the user status value within a job, based on a recent project. In this example the job design is:
ODBC ----> Transformer ----> SeqFile
The ODBC stage executes a stored procedure (in SQL Server as it happens) that inserts a new row in a table, generating a guid (guaranteed unique id) value and returning this value and the columns from the row as a recordset. Subsequent jobs need to update this row; it's a row in a control file managing process metadata and restartability.
All columns are transmitted to the Transformer stage and are passed unchanged to the sequential file. In addition, the unique id (as a VarChar(36) for anyone who needs to know) is passed to an additional output column, the derivation for which is:
DSSetUserStatus(InputLink.TableID)
This column then goes into the output file as the return value of the DSSetUserStatus() function, which in my experience is always 0.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Hi Ray,

I don't realy yet understand your Problem, so I write something about the function you use, where I am assuming, that you know this details already.

Let us assume you have a Job1 and a Job2.

In Job1 you have anywhere the function DSSetUserStatus("It is a nice day")

When you have in Job2 for example the following code:

JobHandle = DSAttachJob("Job1", DSJ.ERRFATAL)
Wert = DSGetJobInfo(JobHandle,DSJ.USERSTATUS)
ErrCode = DSDetachJob(JobHandle)

you can use the String "It is a nice day" in Job2 for whatever you want.

By this you can pass a string from one job to another.

(to "another job" and not back to the same job!!!)

What you cannot do is:

- Make a DSAttachJob("Job1", DSJ.ERRFATAL) within Job1

When you make a
Wert=DSGetJobInfo(DSJ.ME,DSJ.USERSTATUS)
after Job hast started then you get nothing.

When you make a
Wert=DSGetJobInfo(DSJ.ME,DSJ.USERSTATUS)
after the
Call DSSetUserStatus("It is a nice day")
you will get
"It is a nice day" or whatever string you put into it.

That are the rules of DSSetUserStatus.

What you are doing else in the Job doesn't matter to this.

Hope I could have helped you a bit. If not please explain a bit more about your problem.

Wolfgang
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Ray,

if you need it in the same job again, the only chance is to pass it after Job1 to Job2 and then next time you need it again in Job1 fetch it from Job2 where you have parked it.

Wolfgang
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Post by nick.bond »

I have tried your solution to this problem, using DSSetUserStatus(INPUT.FIELD) in the derivation of one of my columns in a transformer but it keeps showing an error.

I am using DS v.7, AIX 5.2

in the derivation section of my output column I write:

DSSetUserStatus (Source.Value)

and it is always red.

I have tried

DSSetUserStatus ("Test") but this doesn't work either.

Is this a problem with version 7 or have I misunderstood something.

Regards, Nick.
Regards,

Nick.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to call it, so write a simple custom routine to do the calling for you. Mine simply calls DSSetUserStatus with the input argument and then passes it (the input argument) back out as the Answer.
-craig

"You can never have too many knives" -- Logan Nine Fingers
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
I'm not sure Ray inteded to ask anything here, or it would have been obvious (what the question is).
by the way if you have no need for the actual value in the seq file why not direct it to the NUL virtual file be it in unix (/dev/null) or windows (forgot the syntax).
I'm sure ray knows bettert then most of us how to get what he wants using DS ;)
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