DSGetStageInfo for Datasets

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
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

DSGetStageInfo for Datasets

Post by jhmckeever »

I don't seem to be able to use the DSGetStageInfo (hJob , 'dsNgr32', DSJ.STAGEDESC)call for datasets. Has anyone had success with this?

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

hJob = DSAttachJob('NGR_34_TTP_FEE', DSJ.ERRFATAL)
sStageDesc = DSGetStageInfo (hJob , 'dsNgr32', DSJ.STAGEDESC)
Call DSLogInfo(sStageDesc, 'Debug')

Ans = sStageDesc
And the test results ...

Code: Select all

TEST #1
*******
 
Arg1 = s
 
Test completed.
 
DSLogFatal called from : DSGetStageInfo
Message to be logged is...
> Job control fatal error (-7)
> (DSGetStageInfo) Unknown stage name dsNgr32 in job NGR_34_TTP_FEE
DSLogInfo called from : Debug
Message to be logged is...
> -7
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The error message suggests that you may have not used the correct name of the stage (spelling? casing?) in the routine call.

Verify that the stage is visible to the job using DSGetJobInfo with one of the stage list options.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Gokul
Participant
Posts: 74
Joined: Wed Feb 23, 2005 10:58 pm
Location: Mumbai

Post by Gokul »

I have been reading this forum for 4 years now. I am amazed by the depth of knowledge and enthusiasm of Ray. The dsxchange should be re-named as rayxchange.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Code: Select all

> Job control fatal error (-7) 
> (DSGetStageInfo) Unknown stage name dsNgr32 in job NGR_34_TTP_FEE
Yup, don't think anyone but Mr Enthusiasm could have figured that one out.

(I kid, I kid, put away the torches)
-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 »

In private correspondence (we work for the same company, though on different projects) TV John assures me that the stage name is correct. Investigations continue.
Last edited by ray.wurlod on Wed Jun 01, 2011 6:08 pm, edited 1 time in total.
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 »

Thought that might be next... heven't there been posts in the past indicating that (for whatever reason) some of these functions just don't seem to like datasets? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

As demonstrated below, the stage name's right, and it only appears to be an issue for datasets ... (or should that be 'for passive stages') ...

Here's my code, and its output:

Code: Select all

hJob = DSAttachJob('NGR_34_TTP_FEE', DSJ.ERRFATAL)
 
Call DSLogInfo(DSGetStageInfo(hJob, 'dsNgr32', DSJ.STAGENAME), 'STAGENAME')
 
DSLogInfo called from : STAGENAME
Message to be logged is...
> dsNgr32

Call DSLogInfo(DSGetStageInfo(hJob, 'dsNgr32', DSJ.STAGEDESC), 'STAGEDESC')

DSLogFatal called from : DSGetStageInfo
Message to be logged is...
> Job control fatal error (-7)
> (DSGetStageInfo) Unknown stage name dsNgr32 in job NGR_34_TTP_FEE
DSLogInfo called from : STAGEDESC
Message to be logged is...
> -7

Call DSLogInfo(DSGetStageInfo(hJob, 'xfm_GLCondition', DSJ.STAGENAME), 'STAGENAME')

DSLogInfo called from : STAGENAME
Message to be logged is...
> xfm_GLCondition

Call DSLogInfo(DSGetStageInfo(hJob, 'xfm_GLCondition', DSJ.STAGEDESC), 'STAGEDESC')

DSLogInfo called from : STAGEDESC
Message to be logged is...
> Test description on transformer xfm_GLCondition

Result = 0
:-(

I tried looking for the description in DS_JOBOBJECTS, but couldn't see it anywhere. Come on Ray ... I know you've got the answer up your DS Wizard's sleeve!
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Amuse yourself with this in the meantime. It verifies that DSJ.STAGEDESC returns -7 on the system where I'm working too. Both when the stage has a description and when the stage has no description.

Code: Select all

FUNCTION StageInfoTest(JobName, StageName)
$INCLUDE DSINCLUDE JOBCONTROL.H

      hJob = DSAttachJob((JobName), DSJ.ERRNONE)
      vJobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
      If vJobName Matches "'-'1N0N"
      Then
         Call DSLogWarn("Failed to attach job, error code " : vJobName, "StageInfoTest")
         Ans = vJobName
      End
      Else
         Ans = 0
         vStageList = DSGetJobInfo(hJob, DSJ.STAGELIST)
         Call DSLogInfo("Active stages: " : @FM : vStageList, "StageInfoTest")
         bStageInList = Index(vStageList, (StageName), 1)
         If bStageInList
         Then
            Call DSLogInfo("Stage " : (StageName) : " found in list.", "StageInfoTest")
         End
         Else
            Call DSLogInfo("Stage " : (StageName) : " not found in list.", "StageInfoTest")
         End
         vStageList = DSGetJobInfo(hJob, DSJ.STAGELIST2)
         Call DSLogInfo("Passive stages: " : @FM : vStageList, "StageInfoTest")
         bStageInList = Index(vStageList, (StageName), 1)
         If bStageInList
         Then
            Call DSLogInfo("Stage " : (StageName) : " found in list.", "StageInfoTest")
            vStageName = DSGetStageInfo(hJob, (StageName), DSJ.STAGENAME)
            Call DSLogInfo("Stage name verfied as " : vStageName, "StageInfoTest")
            vStageDesc = DSGetStageInfo(hJob, (StageName), DSJ.STAGEDESC)
            Call DSLogInfo("Stage description = " : Quote(vStageDesc), "StageInfoTest")
         End
         Else
            Call DSLogInfo("Stage " : (StageName) : " not found in list.", "StageInfoTest")
         End

      End
RETURN(Ans)
The description is not stored in the Generated OSH.
Investigations continue.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, the stage description is in field #4 (DESC) of the pertinent DS_JOBOBJECTS record. You can get it with a query or with code.

Code: Select all

SELECT "DESC" FROM DS_JOBOBJECTS WHERE OBJIDNO = (SELECT JOBNO FROM DS_JOBS WHERE NAME = '<<JobName>>') AND OLETYPE = 'CCustomStage' AND NAME = '<<StageName>>';

Code: Select all

FUNCTION StageInfoTest(JobName, StageName)
$INCLUDE DSINCLUDE JOBCONTROL.H

      hJob = DSAttachJob((JobName), DSJ.ERRNONE)
      vJobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
      If vJobName Matches "'-'1N0N"
      Then
         Call DSLogWarn("Failed to attach job, error code " : vJobName, "StageInfoTest")
         Ans = vJobName
      End
      Else
         Ans = 0
         vStageList = DSGetJobInfo(hJob, DSJ.STAGELIST)
         Call DSLogInfo("Active stages: " : @FM : vStageList, "StageInfoTest")
         bStageInList = Index(vStageList, (StageName), 1)
         If bStageInList
         Then
            Call DSLogInfo("Stage " : (StageName) : " found in list.", "StageInfoTest")
         End
         Else
            Call DSLogInfo("Stage " : (StageName) : " not found in list.", "StageInfoTest")
         End
         vStageList = DSGetJobInfo(hJob, DSJ.STAGELIST2)
         Call DSLogInfo("Passive stages: " : @FM : vStageList, "StageInfoTest")
         bStageInList = Index(vStageList, (StageName), 1)
         If bStageInList
         Then
            Call DSLogInfo("Stage " : (StageName) : " found in list.", "StageInfoTest")
            vStageName = DSGetStageInfo(hJob, (StageName), DSJ.STAGENAME)
            Call DSLogInfo("Stage name verfied as " : vStageName, "StageInfoTest")
            vStageDesc = DSGetStageInfo(hJob, (StageName), DSJ.STAGEDESC)
            Call DSLogInfo("Stage description = " : Quote(vStageDesc), "StageInfoTest")
            vJobNo = Trim(Trans("DS_JOBS", (JobName), 5, "X"))
            Perform "SELECT DS_JOBOBJECTS WITH OBJIDNO = '" : vJobNo : "' AND OLETYPE = 'CCustomStage' AND NAME = '" : (StageName) : "' TO 9"
            ReadNext vJobObjectsID From 9
            Then
               vStageDesc = Trans("DS_JOBOBJECTS", vJobObjectsID, 4, "X")
               Call DSLogInfo("Stage description is " : Quote(vStageDesc), "StageInfoTest")
            End
            Else
               Call DSLogWarn("No DS_JOBOBJECTS record found.", "StageInfoTest")
            End
         End
         Else
            Call DSLogInfo("Stage " : (StageName) : " not found in list.", "StageInfoTest")
         End

      End
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Ray Wurlod: Information Champion, Certified Genius.

Your Guinness awaits you at the Sherlock Holmes public house - next time you drop into the Melbourne office. (also, our Tuesday night trivia team there could REALLY use your help)

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Post Reply