Page 1 of 1

DSSetUserStatus in Job

Posted: Wed Feb 12, 2003 3:48 am
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

Posted: Wed Feb 12, 2003 8:42 am
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

Posted: Wed Feb 12, 2003 8:46 am
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

Posted: Tue Feb 17, 2004 9:53 am
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.

Posted: Tue Feb 17, 2004 10:47 am
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.

Posted: Wed Feb 18, 2004 3:55 am
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 ;)