Page 1 of 1

Warning in Function compilation

Posted: Thu Mar 24, 2005 12:07 pm
by eoyylo
Hi,
I tried to compile the next function:
---------------------------------------------------------------------------

$INCLUDE DSINCLUDE JOBCONTROL.H

Call DSLogInfo('Funzione ABISParameter-- Inizio','ABISParameter' )



KshPath="/var/opt/ascential/abis/shell/"
DataPath="/var/opt/ascential/abis/data/"


Ans='ND'

If substrings (NOME_JOB,1,3) ='Log' Then
JOBID=substrings (NOME_JOB,4,Len(NOME_JOB))
End
Else
JOBID=NOME_JOB
End

If Left(JOBID,8 ) = "H3GITmis" Then
hJob=DSAttachJob(JOBID , DSJ.ERRFATAL)

STATO = DSGetJobInfo(hJob,DSJ.JOBSTATUS)

Call DSLogInfo ('Stato job -->':STATO ,'ABIS')

if ((STATO= '97') OR (STATO = '3')) Then

ErrorCode=DSRunJob(hJob, DSJ.RUNRESET)

End


ParList=DSGetJobInfo(hJob,DSJ.PARAMLIST)
ParList=" ":CHANGE(ParList,","," , "):" "

If INDEX(ParList," PARAMETRO",1)> 0 Then

StartName=INDEX(ParList," PARAMETRO",1)
ParList=trim(substrings(ParList,StartName,Len(ParList)))

If INDEX(ParList," ",1) > 1 Then
EndName=INDEX(ParList," ",1)
ParName=trim(substrings(ParList, 1, EndName))
End
Else
ParName=trim(ParList)
End

Start=INDEX(ParName,"_",1)
EndLen=Len(ParName)
NumPar=trim(substrings(ParName, Start+1, EndLen))

NomeFile=DataPath:'ABIS_params_':NumPar
NomeParametro='PARAMETRO_':NumPar

Call DSLogInfo('Lettura del parametro numero ':NumPar ,"ABISReadParameter")

KshReadPar.Cmd = KshPath:"EXC_PARALLEL_PARAMS.ksh ":STGUSR:" ":STGPSW:" ":STGDB:" ":NumPar
Call 'DSU.ExecSH'(KshReadPar.Cmd, r$6)
KshReadPar.$ReturnValue = r$6

OpenSeq NomeFile To FileVar Else Call DSLogFatal('Errore nella lettura del parametro ':NumPar , "ABISReadParameter")

ReadSeq Valore From FileVar Then ValoreParametro = Valore
CloseSeq FileVar

If ValoreParametro='' then
Call DSLogWarn('Errore nel parametro di filtro ':NumPar, 'ABISReadParameter')
Abort
End

Call DSLogInfo('Parametro -->':ValoreParametro:'<--',"ABISReadParameter")

Ans=ValoreParametro

End

End



Call DSLogInfo('Funzione ABISParameter -- Fine','ABISParameter' )


-----------------------------------------------------------------------------


The function input variable are:

NOME_JOB
STGDB
STGUSR
STGPSW

When I try to compile the code i Obtain the next warning:

WARNING: Variable-> 'NomeFile' is substituted for-> 'STGDB' on line-> '64' If an input link column variable is used for this argument DataStage runtime may fail.
WARNING: Variable-> 'Valore' is substituted for-> 'STGDB' on line-> '66' If an input link column variable is used for this argument DataStage runtime may fail.
WARNING: Variable-> 'FileVar' is substituted for-> 'STGUSR' on line-> '67' If an input link column variable is used for this argument DataStage runtime may fail.
WARNING: Variable-> 'FileVar' is substituted for-> 'STGPSW' on line-> '67' If an input link column variable is used for this argument DataStage runtime may fail.
Compiled with no errors


Why?
I don't understand the warnig messages.
Can someone help me?

Thanks in advance

Regards

Mario Loreti

Posted: Thu Mar 24, 2005 3:05 pm
by chucksmith
Why are there quotes aroung DSU.ExecSH?

Perhaps you should look at DSExecute.

Posted: Thu Mar 24, 2005 4:27 pm
by ray.wurlod
These warnings are simply to alert you to the fact that arguments are passed by reference so that, if you change any of them, the change will propagate back to the caller.

You will notice that, following these warnings, the message "compiled with no errors" appears. That's the one that's important.

DataStage philosophy is to warn you whenever even the possibility of a problem occurs.

Posted: Tue Mar 29, 2005 1:00 pm
by eoyylo
Hy Ray,
the warning are about variable (NomeFile, Valore, FileVar) defined in the code and they aren't argument of the function .

Is it possible, with this language, to pass argument by reference or by value????

Thanks

Mario

Posted: Tue Mar 29, 2005 3:57 pm
by ray.wurlod
All arguments are passed by reference, which is why DataStage generates the warnings, "just in case".

There is a trick to emulate pass by value; in the caller use an expression rather than a variable. The easiest way to do this is to enclose the variable name in parentheses. This works because it is not possible to assign a value to an expression.

Code: Select all

MyRoutine((InLink.Column1), (@DATE))
But you will always get the warnings from the compiler.