External Source Stage Fatal error

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
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

External Source Stage Fatal error

Post 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..?
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try "escaping" the single-quote characters ( \' ).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post 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
Regards
Ragu
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post 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
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What do the colon characters do if executed at the operating system shell prompt?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post 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
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Perhaps you need to "escape" the colon characters also.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply