× 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 Ryan,

Not sure why you are having this problem...

But, I find myself wondering why you don't use the include file in QSYSINC? There's already an IBM-supplied prototype for QTVOPNVT that you could be using. Why create your own?

Also, you haven't posted information about how the IbmApiError object is created or initialized... can you, at least, show us a hex dump of the contents of that structure prior to calling the OpenVT() API?



On 11/2/2011 10:06 AM, Ryan Downing wrote:
The code:


////// Inside CIbmApiError /////////


#include<qusec.h>

static const int USE_ERRC0200 = -1;

struct StQus_ERRC0100 :
public Qus_EC
/*
int Bytes_Provided;
int Bytes_Available;
char Exception_Id[7];
char Reserved;
*/
{
char Exception_Data[1024];
} m_stQus_ERRC0100;


CIbmApiError::StQus_ERRC0100* CIbmApiError::GetStructPointer()
{
return&m_stQus_ERRC0100;
}


void CIbmApiError::Clear()
{
m_stQus_ERRC0100.Bytes_Provided = sizeof(m_stQus_ERRC0100);
m_stQus_ERRC0100.Bytes_Available = 0;

memset(&m_stQus_ERRC0100.Exception_Id, ' ',
sizeof(m_stQus_ERRC0100.Exception_Id));
memset(&m_stQus_ERRC0100.Reserved, ' ', sizeof(m_stQus_ERRC0100.Reserved));
memset(&m_stQus_ERRC0100.Exception_Data,' ',
sizeof(m_stQus_ERRC0100.Exception_Data));
}


//////Actual Call//////

#pragma exception_handler (CVTProvider::EH, 0, 0, _C2_ALL, _CTLA_HANDLE)

OpenVT( m_szVTHandle,
szKeyboardType,
nCharacterSet,
nCodePage,
nWorkStnType,
szDtaName,
m_szDqKeyValue,
dKeyLength,
IbmApiError.GetStructPointer(),

szOpenOpInfo,
SessionInitInfo,
(char *)&stOpenFeedback,
sizeof(Qtv_Opnvt_Feedback) );
#pragma disable_handler

Thanks!

--Ryan

Ryan Downing
myBCDSoftware Portal Administrator
ExcelSystems Software Development Inc.
rdowning@xxxxxxxxxxxxxxxx
Phone: (250) 655-1766


On Tue, Nov 1, 2011 at 6:09 PM, Dennis Lovelady<iseries@xxxxxxxxxxxx>wrote:

I don't see the "call" (as you referred to it) but the prototype looks OK.

Would like to see the error code structure, its initialization and the code
that calls the API.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
Tom Seaver: "What time is it?"
Yogi Berra: "You mean now?"


I'm a little new to this iSeries thing, and I have a problem I was
hoping someone could help me with...

I'm opening a virtual terminal session to an iSeries using the IBM API
QTVOPNVT in a C++ program using all three of the optional parameter
groups.

The current issue under test is what happens if the data queue
mentioned in the function call (6th parm) is missing. The program
works correctly in other circumstances with both exception handling
and error struct passing.

Using the pragma style exception handling, it correctly returns a
CPF9801 in the caught error. Passing in a Qus_EC struct with
Bytes_Provided set to a non-zero value crashes the program. Looking
in the IBM documentation for the API call, CPF9801 (or, for that
matter, any sort of "data queue not found" type error) doesn't appear
in the expected errors list, so I'm thinking it might not be able to
handle this eventuality.

My shop has strong feelings towards using only return value error
handling, so I'd prefer not to use the exception method, but the only
way I can think of to get around it right now is to first do another
API call to test existence of the data queue and I'd like to avoid the
performance hit.

Does anyone know if there's a way to get the best of both worlds?
Maybe I'm doing something wrong on the call...? Even confirmation
that I can't get a return of this value would be great.

Definition of API:


#pragma map(OpenVT,"QTVOPNVT")
extern "OS" void OpenVT(
char *,
char *,
int,
int,
int,
char *, /* Passing in a Queue here
which
does not exist */
char *,
int,
void *,
char *,
char *,
char *,
int);


Cheers,
Ryan
--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.


--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.