Page 1 of 1

Need to add blank/empty line at the end of the file

Posted: Fri Feb 21, 2014 5:13 am
by srini.dw
Hi Guys,

Need 1 help to generate a blank line in the output file at end.

Job desgin

Code: Select all

External_source_1
External_source_2   -> Funnel -> Sequential Stage
Row_Generator
Iam getting the output, the only issue is need a blank line in the output file at the end.

Any help would be appreciated.

Thanks,

Posted: Fri Feb 21, 2014 5:17 am
by ray.wurlod
Use an after-job subroutine ExecSH or ExecSHSilent to execute the command

Code: Select all

echo '' >> #filepath#

Posted: Fri Feb 21, 2014 5:23 am
by anbu
Add this command to filter option in target sequential file

Code: Select all

awk ' { print } END { print "" } ' 

Posted: Fri Feb 21, 2014 5:28 am
by srini.dw
Thanks for the replies.

@Ray Before and after job commands are not in the company standards.

@Anbu, i will try this option now.

Thanks,

Posted: Fri Feb 21, 2014 5:39 am
by srini.dw
Hi, Have tried the option of awk

Without the awk command, iam getting the below output.

Code: Select all

Job_No;65
# 1 blank line
Sequence[1;2]
Job_no;1
With the awk command, iam getting the below output.

Code: Select all

Job_No;65
# 1 blank line
# 2nd blank line is coming
Sequence[1;2]
Job_no;1
#Blank line is coming
How to remove the 2nd blank lines, any ideas.

Thanks,

Posted: Fri Feb 21, 2014 5:44 am
by anbu
Awk command prints only one blank line at the end of your output. Verify whether your input stage is generating extra blank lines

Code: Select all

$ echo "Job_No;65
>
> Sequence[1;2]
> Job_no;1 " | awk ' { print } END { print "" } '
Job_No;65

Sequence[1;2]
Job_no;1

$

Posted: Fri Feb 21, 2014 5:56 am
by srini.dw
The awk command is working fine, will check the extra spaces, Thank you.

Posted: Fri Feb 21, 2014 8:30 am
by chulett
srini.dw wrote:Before and after job commands are not in the company standards.
I love nonsensical standards. :roll:

Posted: Fri Feb 21, 2014 2:14 pm
by ray.wurlod
How/where are you executing awk, if not as an after-job command? :?

Posted: Fri Feb 21, 2014 2:18 pm
by chulett
anbu wrote:Add this awk command to filter option in target sequential file

Reply

Posted: Sun Feb 23, 2014 7:03 pm
by ssnegi
You can do this in datastage also.
Add a row generator (No of Records = 1) with char columns with similar names as input and an additional column DUMMY char(1). Set null values '' for all the columns.
Add the DUMMY column char(1) to input also and put 1 in transformer.
Then funnel both these links. Use Sequence funnel with the link ordering set to 1 for the link from the row generator. The row from the input records should be 0.
sequential file properties :
format tab - null field value :null
Partioning tab : DUMMY column SortMerge "Perform sort" ticked Descending with nulls last.
This way the empty row from the row generator would be the last row processed.

Posted: Mon Feb 24, 2014 1:21 am
by srini.dw
Thanks guys for the replies..