Page 1 of 1
External Source Stage Fatal error
Posted: Tue Apr 12, 2011 3:28 pm
by Ragunathan Gunasekaran
Hi ,
I am using an external source stage to capture the file creation date and time . The source program is provided as below
Code: Select all
ls -t --full-time #pDirName#/filename.txt| sed 's/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/:&:/'|cut -d':' -f2-4
The entire command is working fine in the command prompt of the Operating sysrem but throws a fatal error from Datastage
Error as below
Code: Select all
Invalid data source specified: Invalid hostname:
Any clues..?
Posted: Tue Apr 12, 2011 4:57 pm
by ray.wurlod
Try "escaping" the single-quote characters ( \' ).
Posted: Wed Apr 13, 2011 12:20 am
by Ragunathan Gunasekaran
Adding escape character to quote Dint solve the problem..
While trying to view the score Datastage itself sends the commands to the operating system with proper escape characters
Code: Select all
#################################################################
#### STAGE: SrcEs_DetailFileCreationDateTime
## Operator
import
## Operator options
-dontUseOffsetsWithSources
-schema record
{final_delim=end, delim=none, quote=none}
(
CreationDateTime:string[];
)
-rejects continue
-source 'ls -t --full-time [&"pDirName"]\/filename.txt| sed \'s\/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\/:&:\/\'|cut -d\':\' -f2-4'
## General options
[ident('SrcEs_DetailFileCreationDateTime'); jobmon_ident('SrcEs_DetailFileCreationDateTime')]
## Outputs
0> [] 'SrcEs_DetailFileCreationDateTime:lk_DetailFileCreationDateTime.v'
;
# End of OSH code
Posted: Wed Apr 13, 2011 1:15 am
by Ragunathan Gunasekaran
Any ':' characters in the command will not work via External source stage. I have changed my command as
stat filename.txt | grep 'Change'|cut -d'.' -f1-1| cut -d' ' -f2-3
The stage worked Fine now
Posted: Wed Apr 13, 2011 2:08 am
by ray.wurlod
What do the colon characters do if executed at the operating system shell prompt?
Posted: Wed Apr 13, 2011 3:56 pm
by Ragunathan Gunasekaran
It gives me a perfect result in the Operating system level. i.e the command displays the date and time as YYYY-MM-DD HH:MM:SS
Posted: Wed Apr 13, 2011 4:35 pm
by ray.wurlod
Perhaps you need to "escape" the colon characters also.