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

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
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

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

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

Post by ray.wurlod »

Use an after-job subroutine ExecSH or ExecSHSilent to execute the command

Code: Select all

echo '' >> #filepath#
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Add this command to filter option in target sequential file

Code: Select all

awk ' { print } END { print "" } ' 
You are the creator of your destiny - Swami Vivekananda
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post 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,
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post 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,
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post 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

$
You are the creator of your destiny - Swami Vivekananda
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post by srini.dw »

The awk command is working fine, will check the extra spaces, Thank you.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

srini.dw wrote:Before and after job commands are not in the company standards.
I love nonsensical standards. :roll:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How/where are you executing awk, if not as an after-job command? :?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

anbu wrote:Add this awk command to filter option in target sequential file
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Reply

Post 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.
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post by srini.dw »

Thanks guys for the replies..
Post Reply