Nested Condition Expression

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
lebos
Participant
Posts: 74
Joined: Mon Jan 20, 2003 10:02 am
Location: USA

Nested Condition Expression

Post by lebos »

The thing that causes me the most grief with DataStage is how hard it is to find detailed information about how something really works. Right now it is how to write an expression in a trigger of a Nested Condition stage of a job sequence. Where do I find this information? I have looked at help, the Core Developer's Guide, and the Server Job Developer's Guide, but can find nothing on this or in fact nothing in any detail on Job Sequences in general.

What I am looking for right now is for a "custom" expression type. The expression defaults to = , but what variables can be used to substitute for and ?

Any help would be greatly appreciated.

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

Post by ray.wurlod »

Theoretically, where "expression" is used, it means "any syntactically valid DataStage expression that uses values that are in context".
Because DataStage is data-type agnostic, the result of any expression can be regarded as being true or not true in a Boolean context; values 0 and "" are regarded as false, any other non-NULL value is regarded as true.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
lebos
Participant
Posts: 74
Joined: Mon Jan 20, 2003 10:02 am
Location: USA

Post by lebos »

Yes, but in a Nested Condition, what is "in context"? Obviously I can't refer to stage variables. And it doesn't seem like input columns (or output columns) would be available. That would seem to leave date and time, which is not a whole lot!

What I am attempting to do is to take a different path in my job sequence depending on whether a particular unix server file is empty or not. I can make such a test in a shell script, but how do I pass information back to a DataStage Nested Condition? And, if I have to go to unix to make these kind of determinations, why should I not just write the controlling code as a shell script instead of a job sequence?

Thanks for providing some insight Ray.

Larry
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I think you are better off calling a DSExecute stage or a routine stage to run the Unix script and then either use the triggers from that stage to redirect the flow or pass the value on to a condition stage.. If your routine stage is called rtnFindFile then your trigger or condition stage would use rtnFileFile.ReturnedValue=1 or rtnFindFile.ReturnedValue = 0.

A sequence job is just a collection of visual objects that help you write job control code. As Ray says any expression can be used in any trigger or condition field that is expecting a formula and it should look the same as when you write it in a control job.

In a sequence job stages that are joined by links can be thought of as a subroutine. A single stage on its own is a subroutine. Therefore values returned by the first stage can be used by any stages further along. Job parameters are readonly global variables available across the entire job. You cannot pass variables such as returned status and returned value backwards up a link and you cannot pass them between stages in seperate subroutines.

Vincent McBurney
Data Integration Services
www.intramatix.com
lebos
Participant
Posts: 74
Joined: Mon Jan 20, 2003 10:02 am
Location: USA

Post by lebos »

Thanks again Ray and Vincent. But:

Unfortunately, I still do not know what vaules are in context in these expressions, nor do I know what document to look in to tell me this.

Can anyone point me in the right direction?

Larry
Sunshine2323
Charter Member
Charter Member
Posts: 130
Joined: Mon Sep 06, 2004 3:05 am
Location: Dubai,UAE

Nested Condition Expression

Post by Sunshine2323 »

Hi All, :)

If you are using NESTED CONDITION then the constraints can be as follows:

If u want to check the job status of the job A and then decide the course of action then use the variable Job_Activity_1.$JobStatus as LHS
E.G
Job_Activity_1.$JobStatus = 1

where Job_Activity_1 is the name of the stage calling the job A

If u want to check the user status of the job A and decide the course of action then use the variable Job_Activity_1.$UserStatus as LHS
E.G
Job_Activity_1.$UserStatus = "SUCCESS"

where Job_Activity_1 is the name of the stage calling the job A

If u are using a routine stage and want to check the returned value of the routine to decide the course of action use the variable Routine_Activity_3.$ReturnValue as LHS
E.G
Routine_Activity_3.$ReturnValue = "SUCCESS"

where Routine_Activity_3 is the name of the stage calling the routine.
Warm Regards,
Amruta Bandekar

<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

This is an old thread and since it was first posted version 7.x has come along where the trigger expression editor now displays a right mouse click menu with all the expressions that are allowed in this field. You now can right mouse click and add functions, routines, job parameters etc to build up a boolean true or false value.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

7.5, unfortunately for those of us currently on 7.1 :cry:
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