Page 1 of 1

DSGetStageInfo for Datasets

Posted: Wed Jun 01, 2011 3:30 am
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

Posted: Wed Jun 01, 2011 5:31 am
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.

Posted: Wed Jun 01, 2011 5:47 am
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.

Posted: Wed Jun 01, 2011 6:25 am
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)

Posted: Wed Jun 01, 2011 5:51 pm
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.

Posted: Wed Jun 01, 2011 5:55 pm
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? :?

Posted: Wed Jun 01, 2011 7:59 pm
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!

Posted: Wed Jun 01, 2011 8:38 pm
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.

Posted: Wed Jun 01, 2011 8:51 pm
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)

Posted: Wed Jun 01, 2011 9:51 pm
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.