× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi,

Does someone have a clever idea how to map the statement identifier returned by the "Retrieve Call Stack (QWVRCSTK) API" to the source line number of the source member?

I want to open the LPEX editor for a given source member and position the cursor to the line number returned by the QWVRCSTK API.

The actual problems are:


a) The source member could have been compiled with *SRCSTMT or *NOSRCSTMT


b) The open() method of the QSYSEditableSourceMember class requires a line number and not an IBM i source sequence number
(But all I have is a source sequence number of type *SRCSTMT or *NOSRCSTMT and not a line number)


c) For option *SRCSTMT the increment value could be any value
(It was easy if it would be 1)


d) For *NOSRCSTMT the statement identifier is incremented by 1 but includes /copy and /include source members

For now it is required that the source must be compiled with *SRCSTMT and I use the following code to get the line number of the source member:

QSYSEditableRemoteSourceFileMember tEditableMember = getEditableSourceMember();
IFile localMember = tEditableMember.getLocalResource();
if (!localMember.exists()) {
tEditableMember.download(Workbench.getInstance().getActiveWorkbenchWindow().getShell());
}
tInpStream = localMember.getContents();
tReader = new BufferedReader(new InputStreamReader(tInpStream));
int tLineNumber = -1;
int tCount = 0;
String line;
while ((line = tReader.readLine()) != null) {
tCount++;
Integer lineNbr = Integer.parseInt(line.substring(0, 6));
if (lineNbr == null) {
break;
}
if (lineNbr.intValue() == aSequenceNumber) {
tLineNumber = tCount;
break;
}
}

It was great if would not have to scan the source member and if I would work for *NOSRCSTMT, too.

Regards,

Thomas.



--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the sender.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.