Sequential File path query

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

Moderators: chulett, rschirm, roy

chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

Code: Select all

find /data/finrecon/SBIRECON/`echo "#$JpBusinessDate#" | tr -d '-'`/GLCCCTA*
OR
ls /data/finrecon/SBIRECON/`echo "#$JpBusinessDate#" | tr -d '-'`/GLCCCTA*
The actual path is
/data/finrecon/SBIRECON/20130419/GLCCCTA*
And I am passing Business Date as 2013-04-19.
I have modified the 1st code as it was not working correctly.
The 2nd code I have pasted same as that of Eric's.
Last edited by chandra.shekhar@tcs.com on Thu Apr 25, 2013 7:54 am, edited 1 time in total.
Thanx and Regards,
ETL User
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

Hi Chandra,

I believe the important word you missed in eph's post is
"or".

You were not supposed to apply both. This is why DataStage tells You that it does not know what to do with "ls".
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

@Roland
Yes, I am not using both of them, I have tried them separately. :(

Just wanted to let you all know that as I have told earlier that I am able to view the data from the stage, that means I have used the code correctly.
But while running the job.. :cry:
Thanx and Regards,
ETL User
eph
Premium Member
Premium Member
Posts: 110
Joined: Mon Oct 18, 2010 10:25 am

Post by eph »

Could you try to put the commands in a Before-job subroutine ExecSH? and add a ";echo TEST" at the end

Like:

Code: Select all

ls /data/finrecon/SBIRECON/`echo "#$JpBusinessDate#" | tr -d '-'`/GLCCCTA*;echo TEST
And give us the result like:

Code: Select all

testSF_CommandLine..BeforeJob (ExecSH): Executed command: ls /app/EQOPIGL/PFI/EROPIGL1/operis/integration/`echo 2013-04-25 | tr -d '-'`/testLS*;echo "TEST"
*** Output from command was: ***
/app/EQOPIGL/PFI/EROPIGL1/operis/integration/20130425/testLS.txt
/app/EQOPIGL/PFI/EROPIGL1/operis/integration/20130425/testLS.txt2
TEST
I'm quite surprised that the first command fails:

Code: Select all

testSF_CommandLine..BeforeJob (ExecSH): Executed command: find /app/EQOPIGL/PFI/EROPIGL1/operis/integration/`echo 2013-04-25 | tr -d '-'` -name "*testLS*";echo "TEST"
*** Output from command was: ***
/app/EQOPIGL/PFI/EROPIGL1/operis/integration/20130425/testLS.txt2
/app/EQOPIGL/PFI/EROPIGL1/operis/integration/20130425/testLS.txt
TEST
Eric
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

@Eric,
I have fired these commands on the server through putty and I got expected result in both cases.
That means the commands are working absolutely fine.
For your confirmation, the output of these commands is the list of the files which are to be read in the stage.
The o/p of the commands when used in BeforeJob subroutine ExecSH is :-
1)

Code: Select all

Executed command: find /data/finrecon/SBIRECON/`echo "20130420" | tr -d '-'`/GLCCCTA*;echo "TEST" 
*** Output from command was: *** 
/data/finrecon/SBIRECON/20130420/GLCCCTA_01.txt 
/data/finrecon/SBIRECON/20130420/GLCCCTA_02.txt
TEST
2)

Code: Select all

Executed command: ls /data/finrecon/SBIRECON/`echo "20130420" | tr -d '-'`/GLCCCTA*;echo "TEST" 
*** Output from command was: *** 
/data/finrecon/SBIRECON/20130420/GLCCCTA_01.txt 
/data/finrecon/SBIRECON/20130420/GLCCCTA_02.txt
TEST
Everything is working correctly, still I doesnt understand why the job is not able to read the last row :cry:
Thanx and Regards,
ETL User
Post Reply