Processing files in a directory

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You gave -warn two times. Only one is needed.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Need more help

Post by sashah »

I get Status code = -2 DSJE_BADSTATE when executing the DSJOB command in a Unix script. I am passing the file name to Sequential File stage in a loop. This is to merge all the files in a directory into one.
DSguru2B wrote:You gave -warn two times. Only one is needed.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Compile the job. DSJE_BADSTATE is indicating that the job is not in a runnable state.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

I did that and when I ran it I see this error in the director

|MLConvertibleHistoryLoad..Sequential_File_23.DSLink39: DSD.SEQOpen No Filename to open..|
Thank you
DSguru2B wrote:Compile the job. DSJE_BADSTATE is indicating that the job is not in a runnable state.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Look in the first entry of the log and see if all the parameters are being passed properly, if any.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

Thank you.

I get an error Status code = -9999 DSJE_DSJOB_ERROR when I am calling DSJob from a Unix script. This job only fails for the file with the name as 3 February 2006.csv. When I test the same from within Datastage it works fine.
Can someone please tell me what I is incorrect out here.
DSguru2B wrote:Look in the first entry of the log and see if all the parameters are being passed properly, if any.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

So you have a file with the name '3 February 2006.csv'? How are you opening this file in your script?
First of all you have spaces in the name of your file, not a good practice, for files on unix. You will need to enclose the name in quotes to perform any operation on it, or else it will not find the file.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

I am passing the file path and file name as a parameter to the Sequential File stage using DSJob that is called from a unix script.
DSguru2B wrote:So you have a file with the name '3 February 2006.csv'? How are you opening this file in your script?
First of all you have spaces in the name of your file, not a good practice, for files on unix. You will need to enclose the name in quotes to perform any operation on it, or else it will not find the file.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You need quotes. Your param should look like

Code: Select all

dsjob -run -param 'FILENAME=/path/of/3 February 2006.csv' 
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

Thank you. That worked. How do I get the status of DSJob in a variable and is there a parameter that I need to pass for DSJob to return the status.
DSguru2B wrote:You need quotes. Your param should look like

Code: Select all

dsjob -run -param 'FILENAME=/path/of/3 February 2006.csv' 
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

These are primary questions and are discussed before. Try searching for them before asking.

Code: Select all

dsjob -run -jobstatus -param .....
RetCd=$?
RetCd will have the jobstatus.
Really, please search before asking.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ivannavi
Premium Member
Premium Member
Posts: 120
Joined: Mon Mar 07, 2005 9:49 am
Location: Croatia

Post by ivannavi »

Is a paralell job an option for you? I ask this because your post is in General forum. With paralell jobs it's easy to do what you request in your original post.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

I will do that. Thank you.
DSguru2B wrote:These are primary questions and are discussed before. Try searching for them before asking.

Code: Select all

dsjob -run -jobstatus -param .....
RetCd=$?
RetCd will have the jobstatus.
Really, please search before asking.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

I have a column in a CSV file that holds Decimal values. However there are some rows with N/A in it. Can I use the Digit function or is there something available that would ignore NA.
Thank you.
sashah wrote:I will do that. Thank you.
DSguru2B wrote:These are primary questions and are discussed before. Try searching for them before asking.

Code: Select all

dsjob -run -jobstatus -param .....
RetCd=$?
RetCd will have the jobstatus.
Really, please search before asking.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sashah - we're well past the scope of your initial post here. You are allowed to have more than one post, ya know. :wink:

When you have new questions, start new threads please.
-craig

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