DSParams routine & TNS name

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Vinothbaskaran
Participant
Posts: 22
Joined: Mon Aug 25, 2008 4:01 am

DSParams routine & TNS name

Post by Vinothbaskaran »

Amigos,

I have a strange issue with one of the projects on a datastage server which hosts mutiple other projects. All the other projects are using the TNS name to connect to the database, while the project 'X' under concern uses IP as the jobs inside it could not resolve the TNS into IP's.

The only difference between 'X' and other projects is that project 'X' uses DSParams routine to pick up parameters from parameter file whereas all the other projects are using a generic batch script which parses the invidual parameter files and issues the dsjob command with parameters appeneded to it.

For ex:
Proj X : batchscript1.sh projectaname jobname ( DSParams routine will sort out the parameters)

Other Projs: batchscript2.sh projectname jobname -param=1 ... -param=n

So am i right in doubting the usage of DSParams is causing datastage not to resolve the IP here? If yes, how do i work around this problem. The probelm that i have here is, i get lot of timeout errors on this project 'X' because is usage of a single IP in this shared environment!!
Vinothbaskaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Probably not, except to the extent that the DSParams routine might not be well-written. Can you post the code of DSParams routine?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Vinothbaskaran
Participant
Posts: 22
Joined: Mon Aug 25, 2008 4:01 am

Post by Vinothbaskaran »

thanks Ray. Here it is..

Code: Select all

$INCLUDE DSINCLUDE DSD_STAGE.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE DSINCLUDE DSD.H
$INCLUDE DSINCLUDE DSD_RTSTATUS.H

      Equ SetParams To 'SetDSParamsFromFile'

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

      JobName = Field(STAGECOM.NAME,'.',1,2)
      ParamList = STAGECOM.JOB.CONFIG<CONTAINER.PARAM.NAMES>
      If ParamList = '' Then
         Call DSLogWarn('Parameters may not be externally derived if the job has no parameters defined.',SetParams)
         Return
      End

      ArgList = Trims(Convert(',',@FM,InputArg))

      ParamDir = ArgList<1>
      If ParamDir = '' Then
         ParamDir = '/IIS/Data/Projects/fdpp/':DSProjectName:'/parameter'
      End
      ParamFile = ArgList<2>
      If ParamFile = '' Then
         ParamFile = 'parameters.lst'
      End
      ExtraFile = ArgList<3>
      If ExtraFile = '' Then
         ExtraFile = '/IIS/Data/Projects/fdpp/':DSProjectName:'/parameter/KEY1000keyparams.csv'
      End

      If System(91) Then
         Delim = '\'
      End Else
         Delim = '/'
      End
      ParamPath = ParamDir:Delim:ParamFile


      Call DSLogInfo('Setting Job Parameters from external source ':ParamPath,SetParams)
      Call DSLogInfo('Setting Key Manager Parameters from ':ExtraFile,SetParams)
      Call DSLogInfo(JobName:' - ':ParamList,SetParams)

      OpenSeq ParamPath To ParamFileVar On Error
         ErrorCode = 1
         Call DSLogFatal('File open error on ':ParamPath:'. Status = ':Status(),SetParams)
      End Else
         Call DSLogWarn('File ':ParamPath:' not found - using default parameters.',SetParams)
         Return
      End

*make sure the keymanager file exists
      Call DSExecute("UNIX","touch ":ExtraFile,OsOutput,OsStatus)
*
      OpenSeq ExtraFile To ExtraParamFileVar On Error
         ErrorCode = 1
         Call DSLogFatal('File open error on ':ParamPath:'. Status = ':Status(),SetParams)
      End Else
         Call DSLogWarn('File ':ParamPath:' not found - using default parameters.',SetParams)
         Return
      End

      StatusFileName = FileInfo(DSRTCOM.RTSTATUS.FVAR,1)
      Readvu LockItem From DSRTCOM.RTSTATUS.FVAR, JobName, 1 On Error
         Call DSLogFatal('File read error for ':JobName:' on ':StatusFileName:'. Status = ':Status(),SetParams)
         ErrorCode = 1
         Return
      End Else
         Call DSLogFatal('Failed to read ':JobName:' record from ':StatusFileName,SetParams)
         ErrorCode = 2
         Return
      End

      StatusId = JobName:'.':STAGECOM.WAVE.NUM
      Readv ParamValues From DSRTCOM.RTSTATUS.FVAR, StatusId, JOB.PARAM.VALUES On Error
         Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
         ErrorCode = 1
         Call DSLogFatal('File read error for ':StatusId:' on ':StatusFileName:'. Status = ':Status(),SetParams)
         Return
      End Else
         Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
         ErrorCode = 2
         Call DSLogFatal('Failed to read ':StatusId:' record from ':StatusFileName,SetParams)
         Return
      End

! Read standard parameters:
      Loop
         ReadSeq ParamData From ParamFileVar On Error
            Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
            ErrorCode = 4
            Call DSLogFatal('File read error on ':ParamPath:'. Status = ':Status(),SetParams)
            Return
         End Else
            Exit
         End
         Gosub SetParamValues:
      Repeat

! Read keymanager parameters:

      Loop
         ReadSeq ParamData From ExtraParamFileVar On Error
            Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
            ErrorCode = 4
            Call DSLogFatal('File read error on ':ExtraFile:'. Status = ':Status(),SetParams)
            Return
         End Else
            Exit
         End
         Gosub SetParamValues:
      Repeat



! Now write the parameter information away to DataStage internal structures

      Writev ParamValues On DSRTCOM.RTSTATUS.FVAR, StatusId, JOB.PARAM.VALUES On Error
         Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
         ErrorCode = 5
         Call DSLogFatal('File write error for ':StatusId:' on ':StatusFileName:'. Status = ':Status(),SetParams)
         Return
      End Else
         Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
         ErrorCode = 6
         Call DSLogFatal('Unable to write ':StatusId:' record on ':StatusFileName:'. Status = ':Status(),SetParams)
         Return
      End
      Release DSRTCOM.RTSTATUS.FVAR, JobName On Error Null
      STAGECOM.JOB.STATUS<JOB.PARAM.VALUES> = ParamValues
      Return

SetParamValues:
      Convert '=' To @FM In ParamData
      ParamName = Trim(ParamData<1>)
      Del ParamData<1>
      ParamValue = Convert(@FM,'=',TrimB(ParamData))
      *Call DSLogInfo("Looking for ":ParamName:" in Job ":JobName,SetParams)
      Locate(ParamName,ParamList,1;ParamPos) Else
         *Call DSLogInfo('Parameter ':ParamName:' does not exist in Job ':JobName,SetParams)
         Return
      End
      Call DSLogInfo("Updating ":ParamName:" in Job ":JobName:" from ":ParamValues<1,ParamPos>:" to ":ParamValue,SetParams)
      ParamValues<1,ParamPos> = ParamValue
      Return
Vinothbaskaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The DSParams routine code is not affecting the address, unless the entry in the parameter file itself is incorrect. Can you please check the entry in the parameter file and in tnsnames.ora for that particular system?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Vinothbaskaran
Participant
Posts: 22
Joined: Mon Aug 25, 2008 4:01 am

Post by Vinothbaskaran »

Oh.. I didn't mention that it's a Teradata that we are connecting to.. sorry!

I did try to ping the database from unix and it doesn't get resolved. And i looked up into /etc/hosts and i couldn't find any entries for the server in it.
Will that be a problem ? If i add entry in to hosts file, will Datastage be able to resolve the IP when the parameters are passed via DSParams routine?
Vinothbaskaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Forget about parameters. They're not relevant here. Your issue is purely one of resolving a host name to its IP address, probably via gethostbyname() function internally.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply