Page 1 of 1

Posted: Tue Jun 29, 2004 9:35 am
by mhester
Are you sure it's not a function?

Regards,

Michael Hester

Posted: Tue Jun 29, 2004 9:41 am
by leomauer
mhester wrote:DSGetLinkMetaData is a function and returns a value.

Regards,

Michael Hester


I know that but I also see the statement in the online manual. It states that the Result is the returned dinamic array.
And I do not have compile problems. The error I am getting are the execution error.
Any idea?

Posted: Tue Jun 29, 2004 9:45 am
by mhester
You caught me before I had a chance to change my reply :roll:

I'm not familiar with this routine, but it sure looks like it is being invoked incorrectly.

Regards,

Posted: Tue Jun 29, 2004 12:21 pm
by kduke
What Michael is saying is it should be 4 arguments so guess one.

Call DSGetLinkMetaData(Result, JobName, LinkName, X)

and print out all the arguments afterwards.

Posted: Tue Jun 29, 2004 12:53 pm
by mhester
Thanks Kim :D

Sometimes I don't say what I mean and when I first read this post I was thinking it was the DSGetLinkInfo and I had replied with "It's a function" and then realized what was actually written and retracted my post.

Michael

Posted: Tue Jun 29, 2004 1:11 pm
by leomauer
kduke wrote:What Michael is saying is it should be 4 arguments so guess one.

Call DSGetLinkMetaData(Result, JobName, LinkName, X)

and print out all the arguments afterwards.
I tried that:
Code:

Call DSGetLinkMetaData(Result, JobName, LinkName, X)
print "JobName = ":JobName
print "LinkName = ":LinkName
print "Result =":Result
print "X = ":X

Ans = Result<1,1>


It compiled. Did not give me the execution error but did not return anything either.
I do not know what to put in X and in what position in the call it should be located. I put it on the back and as you can see the acquired value was Empty string:

TEST #1
*******

Arg1 = LeoT
Arg2 = NonMatchesOut

Test completed.

JobName = LeoT
LinkName = NonMatchesOut
Result =
X = Program "DSU.LeoGetLink": Line 7, Variable "X" previously undefined. Empty string used.


Result =


Does this function really work?
It is in pdf documentation file (I gave the exert from it in my original posting). But it is not in Help index.

Posted: Tue Jun 29, 2004 1:31 pm
by chulett
A quick search through my install shows a mention of this function only in the DSR_GETRTCONFIG.H file. This would lead me to believe it is part of the RTI services and therefore not available to mere mortals and Server jobs. :wink:

Posted: Mon Aug 09, 2004 5:34 am
by Lanover
DSGetLinkMetaData does work, The LinkId referenced is in fact the Passive Stage name and the fourth parameter is a null string.

This example routine creates a cobol style copy book and works as follows:

Picks up the target directory from the job parameter.
Checks to see if the target file exists - if not it creates it based on the name of the link LinkID
Uses DSGetLinkMetaData to obtain a dynamic array containing all metadata info
Counts the Value Markers for the first element in the array by DCOUNT on @VM
Loops around to extract FieldNames and Lengths and prints to file
closes file


Equ Me to "BuildCopyBook"

* Picks up the target directory from the job parameter pFileDirectory.
* Checks to see if the target file exists - if not it creates it based on the name of the link LinkID

lFileToCreate = pFileDirectory : "\" : LinkID
OPENSEQ lFileToCreate To H.OutFile Else
Call DSU.CreateFile(Err, pFileDirectory , LinkID , 1)
If Err = @True Then
Call DSU.DoTrace(ReturnCode , "Write Failure on " , Me , "WARN")
End
Else
OPENSEQ lFileToCreate To H.OutFile Else
Call DSU.DoTrace(ReturnCode , "Write Failure on " , Me , "WARN")

End
End
End

* Use DSGetLinkMetaData to obtain a dynamic array containing all metadata info
Call DSGetLinkMetaData(Result, JobName, LinkID, '')
Ans = Result

* Count the Value Markers for the first element in the array by DCOUNT on @VM
SubStringCount5 = DCOUNT(Result<1>, @VM)

* Loop around to extract FieldNames and Lengths and prints to file
For i = 1 to SubStringCount5
WriteSeq "03 ":Result<1,i> : " PIC X(": Result<6,i> :")" To H.OutFile Else
Call DSU.DoTrace(ReturnCode , "Write Failure on " , Me , "WARN")
End
Next i

* close file
CLOSESEQ H.OutFile

Posted: Fri Jun 17, 2005 11:04 am
by newtier
We are running 7.5.1 on AIX.

To get DSGetLinkMetaData to work, we had to use the CALL format, and pass 4 arguments (contrary to the docs or the function header):

1) A name to represent the dynamic result array
2) Job name
3) Stage name
4) Link name

Posted: Fri Jun 17, 2005 5:35 pm
by ray.wurlod
Functions in DataStage BASIC are implemented as subroutines. Either of the following will work.

Code: Select all

Call DSGetLinkMetaData(Result, JobName, StageName, LinkName)
or

Code: Select all

Result = DSGetLinkMetaData(JobName, StageName, LinkName)
Of course, you will need a DEFFUN in the second case, so will need to determine with what prefix DSGetLinkMetaData is cataloged. Writing from an airport lounge, I can't help with that.

Posted: Mon May 25, 2009 12:44 am
by ray.wurlod
IF LinkName is unique in the job, then StageName can be "" and it still works, at least in version 8.0.1. That means a lot less code.

Posted: Mon May 25, 2009 7:29 am
by chulett
Interesting, thanks. Was wondering what made you reply to a four year old post. Sure that's not just another of those infamous 8.0.1 bugs? If I can get my 8.1 client working, I'll see if I can test that out later this week.

Posted: Mon May 25, 2009 3:47 pm
by ray.wurlod
No, I just happened to need to use the routine this week (on 8.0.1). Created a generic routine to retrieve a link row count.

Code: Select all

FUNCTION GetColumnHeadings(aJobName, aLinkName)

DEFFUN DSGetLinkMetaData(TheJobName, TheStageName, TheLinkName)

**************************************************************************
* Handle unassigned, empty or null Job Name argument
**************************************************************************
      If UnAssigned(aJobName) Or (Len(aJobName) = 0)
      Then
         Return(@NULL)                   ; * failure
      End

**************************************************************************
* Handle unassigned, empty or null aLinkName argument
**************************************************************************
      If UnAssigned(aLinkName) Or (Len(aLinkName) = 0)
         Then LinkName = "Pri__Output"
         Else LinkName = aLinkName

      StageName = ""

      Result = DSGetLinkMetaData((aJobName), StageName, LinkName)

      Ans = Convert(@VM:@SM:@TM,",,,",Result<1>)

RETURN(Ans)