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
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 9:48 am
I need a header to a target sequential file showing how many records getting from source to target sequential file whenevery this job runs. How can I do this. Any help on this would be appreciated.
Thanks.
ShaneMuir
Premium Member
Posts: 508 Joined: Tue Jun 15, 2004 5:00 am
Location: London
Post
by ShaneMuir » Thu May 21, 2009 9:53 am
If i understand you have an input sequential file and you which to basically add a header record to it which has a line count of the input header file?
If that is the case - use unix commands.
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 10:43 am
I have a source oracle table,transformer and sequentail file. when i run this job i want to see number of records count + all records in sequentail file.
row count: 2
column1 column2
1 XXXX
2 XXX
nagarjuna
Premium Member
Posts: 533 Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago
Post
by nagarjuna » Thu May 21, 2009 11:13 am
Write a unix script like
var=`cat filename | wc -l`
echo "Row count : $var " > outputfile
cat file >> outputfile .
call it in after job routine .
Nag
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 12:40 pm
I am getting this error
Test1..AfterJob (ExecSHSilent): Error when executing command.
*** Output from command was: ***
/**/***/***/test.ksh[2]: var: not found
cat: input/output files '/***/***/test.txt' identical
priyadarshikunal
Premium Member
Posts: 1735 Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI
Post
by priyadarshikunal » Thu May 21, 2009 12:41 pm
And if the first line is column name then $var-1
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
nagarjuna
Premium Member
Posts: 533 Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago
Post
by nagarjuna » Thu May 21, 2009 12:42 pm
Try to execute your script from unix ( OS ) .If its running properly without errors then put it in after job routines .
Nag
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 12:53 pm
Getting same error in unix too. something problem with script.
priyadarshikunal
Premium Member
Posts: 1735 Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI
Post
by priyadarshikunal » Thu May 21, 2009 12:59 pm
reshma11 wrote: Getting same error in unix too. something problem with script.
its running fine for me.
post the script you are using.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 1:32 pm
I am kind of novice in writting unix scripts, please excusme me if i am doing any worng.
#!/bin/ksh
$var
var = 'cat /***/***/test.txt | wc -l'
echo "row count : $var" > /***/**/test.txt
cat /***/***/test.txt >> /****/***/test.txt
Thanks for your help
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 1:34 pm
I am kind of novice in writting unix scripts, please excusme me if i am doing any wrong.
#!/bin/ksh
$var
var = 'cat /***/***/test.txt | wc -l'
echo "row count : $var" > /***/**/test.txt
cat /***/***/test.txt >> /****/***/test.txt
Thanks for your help
nagarjuna
Premium Member
Posts: 533 Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago
Post
by nagarjuna » Thu May 21, 2009 1:38 pm
var = 'cat /***/***/test.txt | wc -l' is different from
var=`cat /***/***/test.txt | wc -l` --- This is correct .Observe that
Its not single quote .Its backquotes ( type tilde symbol )
Nag
nagarjuna
Premium Member
Posts: 533 Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago
Post
by nagarjuna » Thu May 21, 2009 1:38 pm
var = 'cat /***/***/test.txt | wc -l' is different from
var=`cat /***/***/test.txt | wc -l` --- This is correct .Observe that
Its not single quote .Its backquotes ( type tilde symbol )
Nag
reshma11
Premium Member
Posts: 25 Joined: Mon Oct 13, 2008 7:52 am
Post
by reshma11 » Thu May 21, 2009 1:49 pm
I correted it to
#!/bin/ksh
var = `cat /runway/interfaces/test.txt | wc -l`
echo "row count : $var" > /runway/interfaces/test.txt
cat /runway/interfaces/test.txt >> /runway/interfaces/test.txt
run the job, but getting this error
bash-3.00$ sh test.ksh
test.ksh: var: not found
cat: input/output files '/runway/interfaces/test.txt' identical
nagarjuna
Premium Member
Posts: 533 Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago
Post
by nagarjuna » Thu May 21, 2009 9:01 pm
var=`cat /***/***/test.txt | wc -l` ---- no space on eitherside of "="
Nag