Read value from text file using Execute Command

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsuser_cai
Premium Member
Premium Member
Posts: 151
Joined: Fri Feb 13, 2009 4:19 pm

Read value from text file using Execute Command

Post by dsuser_cai »

Hi

I have a issue when im reading from a text file. This is a job sequence. Job1 (J1) creates a text file with one row. (out put of j1 will be 1234 just a number). then i use a execute command stage to read this value from the file. The command is cat and in the parameter i have given /<path_name>/<file_name.txt>. then there is a third one job3 (J3) this takes the value from the out put of the execute command and uses as a parameter to generate surrogate key.

Code: Select all

J1 ----> EXE_Cmd ----> J3
now when i run the job i get the following error message:
1)Info
Sequence_Restart..JobControl (@Execute_Command_39): Executed: cat /etl/PDAODS_Dev/temp/text.txt
Reply=2
Output from command ====>
cat: 0652-050 Cannot open /etl/PDAODS_Dev/temp/text.txt.

2) warning message:
Sequence_Restart..JobControl (@Job_Activity_33): Controller problem: Error calling DSSetParam(LastKey), code=-4
[ParamValue/Limitvalue is not appropriate]

3)Sequence_Restart..JobControl (@Coordinator): Summary of sequence run
15:59:50: Sequence started
15:59:50: Job_Activity_28 (JOB Unix_Mail) started
15:59:57: Job_Activity_28 (JOB Unix_Mail) finished, status=1 [Finished OK]
15:59:57: Execute_Command_39 (COMMAND cat) started
15:59:57: Execute_Command_39 finished, reply=2
15:59:57: Job_Activity_33 (JOB update_table_job) started
15:59:57: Exception raised: @Job_Activity_33, Error calling DSSetParam(LastKey), code=-4 [ParamValue/Limitvalue is not appropriate]
15:59:57: Sequence failed
Thanks
Karthick
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

At the moment, your [ParamValue/Limitvalue is not appropriate] error is being caused by the fact that it cannot cat the file you've asked it to:

Output from command ====>
cat: 0652-050 Cannot open /etl/PDAODS_Dev/temp/text.txt


You need to solve the your 'cat' problem first. Does the filename as logged exist? Does the user have the necessary permissions to it all the way up the path?
-craig

"You can never have too many knives" -- Logan Nine Fingers
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Check if the file cat /etl/PDAODS_Dev/temp/text.txt is present and required permissions are there on that file
Nag
dsuser_cai
Premium Member
Premium Member
Posts: 151
Joined: Fri Feb 13, 2009 4:19 pm

Post by dsuser_cai »

I checked cat /etl/PDAODS_Dev/temp/text.txt and this is working now, but i have one more issue, now.

This text file has 2 fields, data type is double. The data in the text file looks like this:

20030125, 20080725

Ans im using a execute command stage to read these values and pass it as parameter to the next job activity. also im using the following in execute command stage:
Expression Type: Return value- (Conditional) and Expression: =0

the Next is a job activity that has the following 2 parameters: para1, para2.

in this job activity stage im using the following:
Name:para1
value expression: Convert(@FM, "", Execute_Command_39.$CommandOutput)

name: para2
Value Expression: Convert(@FM, "", Execute_Command_39.$CommandOutput)

now when i check the job it runs fine without any warning. but its only passing the first parameter (para1= 20030125) for both para1 and para2. Can anybody tell me where im going wrong. Also i have checked in the job im using correct parameter names.
Thanks
Karthick
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your "value expressions" for both are identical hence the identical result. You need to throw a Field() in there to pull the first field or the second field from the output rather than the entire string.
-craig

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