read txt from a job sequence

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

fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

read txt from a job sequence

Post 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
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, that wouldn't be needed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post by fmartinsferreira »

chulett wrote:No, that wouldn't be needed. ...
So, how can I store the value to pass to the parameter?

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

Post by chulett »

You don't "store" it, the next job can pick up the $CommandOutput variable from the Execute Command stage for example.
-craig

"You can never have too many knives" -- Logan Nine Fingers
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The Power of Search can help! Search for "ParamValue/Limitvalue is not appropriate" and all will be revealed. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

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

Post 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))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From a Routine Activity stage, sure. Inside the routine use DSExecute and then remove any @FM before returning the result.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply