passing job parameter to after job routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

passing job parameter to after job routine

Post by naren6876 »

Hi,

I have a job which has one seqfile as source and one seqfile as target.
And I have add a job parameter for this job.
My target seqfile name is dup_#job parameter#.
In this job iam calling a after job routine.

SUBROUTINE DUP(InputArg,ErrorCode)

filename = "/DUP_#job parameter#"
Call DSExecute("UNIX","sort -u /DUP_#job parameter# > /UNI_DUP_#job parameter#", Output, SystemReturnCode)

Call DSExecute("UNIX","wc -l /DUP_#job parameter#", OutputA, SystemReturnCode)

Call DSExecute("UNIX","wc -l /UNI_DUP_#job parameter#", OutputB, SystemReturnCode)

If OCONV(OutputA,"MCN")<>OCONV(OutputB,"MCN") Then

Call DSLogWarn("Duplicate Records":filename,"MyRoutine")

End

ErrorCode = 0 ;* set this to non-zero to stop the stage/job
RETURN

Iam not getting the job parameter value into the after job routine.
Please help me out.

TIA
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

So, you should be passing #job parameter# in the input argument. Of course, this is not your real parameter name?

Your calculation of filename needs to be altered slightly:

Code: Select all

filename = "/DUP" : InputArg
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post by naren6876 »

Hi,

filename = "/DUP_":InputArg
filename1 = "/UNI_DUP_":InputArg

Call DSExecute("UNIX","sort -u filename > filename1", Output, SystemReturnCode)

Call DSExecute("UNIX","cat filename | wc -l", OutputA, SystemReturnCode)

Call DSExecute("UNIX","cat filename1 | wc -l", OutputB, SystemReturnCode)

If OutputA<>OutputB Then

Call DSLogWarn("Duplicate Records":filename,"MyRoutine")

End

ErrorCode = 0 ;* set this to non-zero to stop the stage/job



Why the above code is not copying the filename contents to filename1?.

Any help will be appreciate.

TIA.
Last edited by naren6876 on Wed Apr 06, 2005 2:08 pm, edited 1 time in total.
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post by leomauer »

I do not think you can use # for delimiting parameter name in BASIC routine. For example in job control it does not read variable if you use #varname# but works fine with just varname.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Check the value of Output and SystemReturnCode following the first call to DSExecute to determine why the target file is not being populated.

Code: Select all

$DEFINE TESTING

Call DSExecute("UNIX","sort -u filename > filename1", Output, SystemReturnCode) 

$IFDEF TESTING
Message = "Value of Output is " : Quote(Output)
Message<-1> = "Value of System Return Code is " : Quote(SystemReturnCode)
Call DSLogInfo(Message, "Testing")
$ENDIF
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Try this:

Code: Select all

ErrorCode = 0 ;* set this to non-zero to stop the stage/job 

filename = "/DUP_":InputArg 
filename1 = "/UNI_DUP_":InputArg 

Call DSExecute("UNIX","sort -u " : filename : " > " :filename1, Output, SystemReturnCode1) 

Call DSExecute("UNIX","cat " : filename : " | wc -l", OutputA, SystemReturnCode2) 

Call DSExecute("UNIX","cat " : filename1 : " | wc -l", OutputB, SystemReturnCode3) 

If OutputA<>OutputB Then 

Call DSLogWarn("Duplicate Records":filename,"MyRoutine") 

End 

ErrorCode = SystemReturnCode1 + SystemReturnCode2 + SystemReturnCode3
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post by naren6876 »

HI,
AfterJob (Testing): Value of Output is "sort: can't stat filename: No such file or directory
"
Value of System Return Code is "2"

Thanks
Naren
ray.wurlod wrote:Check the value of Output and SystemReturnCode following the first call to DSExecute to determine why the target file is not being populated.

Code: Select all

$DEFINE TESTING

Call DSExecute("UNIX","sort -u filename > filename1", Output, SystemReturnCode) 

$IFDEF TESTING
Message = "Value of Output is " : Quote(Output)
Message<-1> = "Value of System Return Code is " : Quote(SystemReturnCode)
Call DSLogInfo(Message, "Testing")
$ENDIF
Post Reply