DSGetLinkMetaData
Moderators: chulett, rschirm, roy
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?
You caught me before I had a chance to change my reply
I'm not familiar with this routine, but it sure looks like it is being invoked incorrectly.
Regards,
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
I'm not familiar with this routine, but it sure looks like it is being invoked incorrectly.
Regards,
Mike Hester
mhester@petra-ps.com
mhester@petra-ps.com
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
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
Mike Hester
mhester@petra-ps.com
mhester@petra-ps.com
I tried that: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.
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.
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Functions in DataStage BASIC are implemented as subroutines. Either of the following will work.
or
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.
Code: Select all
Call DSGetLinkMetaData(Result, JobName, StageName, LinkName)
Code: Select all
Result = DSGetLinkMetaData(JobName, StageName, LinkName)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.