Job control Awk issue

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
Ashish
Participant
Posts: 57
Joined: Tue Jan 31, 2006 1:16 am

Job control Awk issue

Post by Ashish »

Hi,

When I am running the below script in Job control, File1 is created but no records ideally it should have 1000 records, I don't know why awk script is not taking parameters.

A =1
B =1000
when I am passing this parameter to below
FileBack = "awk 'NR==A,NR==B'":" ":FileName:">":FileName:"1"
Call DSExecute('UNIX', FileBack, out,Return)

Please suggest the solution
Thanks
A
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

A and B within quotes may be taken a literal.

Display the FileBack before executing.

What are the resulting values for out and Return?
Ashish
Participant
Posts: 57
Joined: Tue Jan 31, 2006 1:16 am

Post by Ashish »

Return code is 0 which means script ran fine
out is blank
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What does the log show as the actual command that was executed?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Does the source file have any record in it?
Ashish
Participant
Posts: 57
Joined: Tue Jan 31, 2006 1:16 am

Post by Ashish »

Yes, src file got 3000 records but I want to create 1000 record file but i don't want to hard code the values for NR, i wanted to pass it through paraemeter only.
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

You concatenate FileName in to it, but don't do the same for A and B

FileBack = "awk 'NR==" : A : ",NR==" : B : "' ":FileName:">":FileName:"1"
Ashish
Participant
Posts: 57
Joined: Tue Jan 31, 2006 1:16 am

Post by Ashish »

Thanks for the solution :)
Post Reply