Search found 11 matches

by faujong
Thu Sep 20, 2018 6:20 am
Forum: General
Topic: How to only write to Seq. File if SELECT return something ?
Replies: 2
Views: 2267

Thank you for your reply. Yes, I meant not to create the file if SELECT returns nothing.
I will see if I can delete the file post-job, if the file only has 1 row (the column headers).

Thank you.
by faujong
Wed Sep 19, 2018 10:50 am
Forum: General
Topic: How to only write to Seq. File if SELECT return something ?
Replies: 2
Views: 2267

How to only write to Seq. File if SELECT return something ?

I have an Oracle Connector stage that SELECT from Oracle database, and write the result to a Sequential File.
How can I only write to the Sequential File if the SELECT statement returns something (if SELECT statement doesn't return anything, don't write to the Sequential File) ?
Thank you.
by faujong
Thu Aug 30, 2018 2:24 pm
Forum: IBM<sup>®</sup> DataStage Enterprise Edition (Formerly Parallel Extender/PX)
Topic: Missing record delimiter "\n", saw EOF instead
Replies: 9
Views: 5159

Re: Missing record delimiter "\n", saw EOF instead

I fixed the warning by adding a Line Feed at the end of the file using Before Job subroutine EXECSH sed -i -e '$a\' /dev/inbound/MyFile_*.csv
by faujong
Thu Aug 30, 2018 12:29 pm
Forum: IBM<sup>®</sup> DataStage Enterprise Edition (Formerly Parallel Extender/PX)
Topic: Missing record delimiter "\n", saw EOF instead
Replies: 9
Views: 5159

Missing record delimiter "\n", saw EOF instead

Our DataStage parallel job has a Sequential File stage that reads a CSV file. This is a sample of the file content. Each row ends with LF (Line Feed - hex = 0A), except the last row has no LF. "Name","Currency","Description"LF "ABC","USD","ABC D...
by faujong
Mon Aug 20, 2018 9:11 am
Forum: General
Topic: Moving file with wildcard and add timestamp to the file name
Replies: 6
Views: 3388

Thank you all. This ExecSH command sucesfully moved the file to the archive folder, and add a timestamp in the front of the file name: for file in /dev/DataStage/myProject/source/TEST/MyFile_*.csv ; do filename=`basename $file`; mv $file /dev/DataStage/myProject/archive/TEST/`date +%Y%m%d_%H%M`.${fi...
by faujong
Mon Aug 20, 2018 9:06 am
Forum: General
Topic: EXECSH command for file in
Replies: 3
Views: 1886

Yes, that's it. Thank you Ray!!
by faujong
Fri Aug 17, 2018 3:29 pm
Forum: General
Topic: EXECSH command for file in
Replies: 3
Views: 1886

EXECSH command for file in

How can I use the following EXECSH command in After-job subroutine ?

Code: Select all

for file in /dev/DataStage/myProject/source/TEST/MyFile_*.csv; do echo "Testing" done
The above code gives an error "sh: -c: line 1: syntax error: unexpected end of file"

Thank you
by faujong
Fri Aug 17, 2018 2:42 pm
Forum: General
Topic: Moving file with wildcard and add timestamp to the file name
Replies: 6
Views: 3388

Thank you. This code does move MyFile_*.csv to the Archive folder and the file name in the Archive folder is MyFile_20180817.csv. mv #Directory_ParameterSet.$Dir_Parm#/TEST/#FileName_Parm# #Directory_ParameterSet.$Archive_Dir_Parm#/TEST/ Once the correct file is in the archive folder, can I rename/c...
by faujong
Fri Aug 17, 2018 10:16 am
Forum: General
Topic: Moving file with wildcard and add timestamp to the file name
Replies: 6
Views: 3388

Moving file with wildcard and add timestamp to the file name

I am using DataStage Designer 11.5. I need to move a file to an archive folder, and add a timestamp in front of the file name. The current folder, archive folder and file name are parameters to the job. #FileName_Parm# is MyFile_*.csv #Directory_ParameterSet.$Dir_Parm# is /dev/DataStage/myProject/so...