DSGetLinkMetaData

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Are you sure it's not a function?

Regards,

Michael Hester
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post 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?
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post 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,
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post 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
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Lanover
Participant
Posts: 3
Joined: Wed Jul 21, 2004 5:17 am

Post 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
newtier
Premium Member
Premium Member
Posts: 27
Joined: Mon Dec 13, 2004 5:50 pm
Location: St. Louis, MO

Post 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
Rick H
Senior Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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 »

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.
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 »

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.
-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 »

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)
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