Page 1 of 2

read txt from a job sequence

Posted: Thu May 15, 2008 7:53 am
by fmartinsferreira
Hi Everyone!

I have a date in a txt file.

And I need to call some jobs from a job sequence and send the date in a txt file to all.

What is the best way?

Regards,

Fernando

Posted: Thu May 15, 2008 8:01 am
by ag_ram
Get that date value(possible in Windows Or UNIX script) from Seq File and assign it to a Job Sequence Job parameter which will in turn be a Job parameter to all Jobs in the Job Sequence.

Posted: Thu May 15, 2008 8:11 am
by chulett
Either a Routine Activity or Execute Command stage can 'cat/type' that file and capture the output. It can then be passed to any downstream job as a job parameter.

Posted: Thu May 15, 2008 8:30 am
by fmartinsferreira
chulett wrote:Either a Routine Activity or Execute Command stage can 'cat/type' that file and capture the output. It can then be passed to any downstream job as a job parameter. ...
In my Server job I have a parameter 'dt' created, should I create a parameter in my sequence job to receive the return of Execute comand stage?

Fernando

Posted: Thu May 15, 2008 9:21 am
by chulett
No, that wouldn't be needed.

Posted: Thu May 15, 2008 10:21 am
by fmartinsferreira
chulett wrote:No, that wouldn't be needed. ...
So, how can I store the value to pass to the parameter?

Fernando

Posted: Thu May 15, 2008 10:24 am
by chulett
You don't "store" it, the next job can pick up the $CommandOutput variable from the Execute Command stage for example.

Posted: Fri May 16, 2008 12:02 pm
by fmartinsferreira
chulett wrote:You don't "store" it, the next job can pick up the $CommandOutput variable from the Execute Command stage for example. ...

To try this solution I:

1 - create 2 files
- file1.txt
-In file1.txt I have writed "worked"
- file2.txt
-In file2.txt I do not have anything writed.

2 - create a "Server Job"
- this job has a parameter named value
- this job get the value of parameter and put it in file2.txt

3 - create a "job sequence"
- this job has a "Execute Command Stage", "Job Activity Stage" and a Link between both.
- the "Execute Command Stage" has the following command
- type D:\temp\file1.txt
- the "Job Activity Stage" has Execute_Command_4.$CommandOutput as "Value Expression"

But when I run the "job sequence" show me de following messages:

Info
stemp1..JobControl (@Execute_Command_4): Executed: type D:\temp\file1.txt
Reply=0
Output from command ====>
worked

Warning
stemp1..JobControl (@temp1): Controller problem: Error calling DSSetParam(value), code=-4
[ParamValue/Limitvalue is not appropriate]

Info
stemp1..JobControl (@Coordinator): Summary of sequence run
14:57:38: Sequence started
14:57:38: Execute_Command_4 (COMMAND type D:\temp\file1.txt) started
14:57:38: Execute_Command_4 finished, reply=0
14:57:38: temp1 (JOB temp1) started
14:57:38: Exception raised: @temp1, Error calling DSSetParam(value), code=-4 [ParamValue/Limitvalue is not appropriate]
14:57:38: Sequence failed

Fatal
temp1..JobControl (fatal error from @Coordinator): Sequence job will abort due to previous unrecoverable errors

Can anybody help me?

Fernando

Posted: Fri May 16, 2008 12:04 pm
by chulett
The Power of Search can help! Search for "ParamValue/Limitvalue is not appropriate" and all will be revealed. :wink:

Posted: Fri May 16, 2008 1:25 pm
by fmartinsferreira
chulett wrote:The Power of Search can help! Search for "ParamValue/Limitvalue is not appropriate" and all will be revealed. :wink: ...
I saw that I need to use something like

Field(Execute_Command_4.$CommandOutput,@FM,1,1)

but anything different from Execute_Command_4.$CommandOutput the datastage give me the same error.

Job parameter names must begin with an alphabetic character and consist of alpha-numerics and underscores only. If you wish to use a literal value, these must be quoted(").

I using version 7.1!

Can anybody throw some light?

Fernando

Posted: Fri May 16, 2008 3:59 pm
by ray.wurlod
You are on the right track, but may have selected the wrong field number in your Field function. I prefer to convert all the line terminators (@FM) to empty strings and trim extraneous space from the result.

Code: Select all

Trim(Convert(@FM,"",ECActivity.$CommandOutput))

Posted: Mon May 19, 2008 11:15 am
by fmartinsferreira
Thanks a lot, but it doesn't work to me! :(

The only thing that I'm able to see is:

Job parameter names must begin with an alphabetic character and consist of alpha-numerics and underscores only. If you wish to use a literal value, these must be quoted(").

Fernando

Posted: Mon May 19, 2008 11:27 am
by chulett
Probably an issue because you are still running 7.1. :cry:

Since you can't do this directly in the Sequence job, you'll need to do all of this work inside a routine and make sure what you pass back as the 'Ans' has been properly cleansed there.

Posted: Tue May 20, 2008 8:32 am
by fmartinsferreira
chulett wrote:Probably an issue because you are still running 7.1. :cry:

Since you can't do this directly in the Sequence job, you'll need to do all of this work inside a routine and make sure what you pass back as the 'Ans' has been properly cleansed there.
Weel, is it possible from a "Job Activity Stage" I call a routine and get the rotine return and pass to a job like a parameter?

Fernando

Posted: Tue May 20, 2008 8:50 am
by chulett
From a Routine Activity stage, sure. Inside the routine use DSExecute and then remove any @FM before returning the result.