• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Detect QSYSOPR message in MS Access VB function?

I've created a Visual Basic function that runs an AS/400 CL program.  The function is called when a button on a form is clicked.

Access receives messages from the AS/400 as long as the message is not waiting on a response.  Is it possible to create a VB error handler when there is a message waiting in the QSYSOPR message queue?
0
hapibooda
Asked:
hapibooda
  • 4
  • 3
  • 2
  • +1
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'd suspect so, but how you handle this would depend on how the "messages" are received and processed by Access. Do you use a third party object to do this, a DLL/OCX etc? In other words, how does Access "receive" the messages from the AS/400?
0
 
hapiboodaAuthor Commented:
Access receives the AS/400 messages through an ADODB connection.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
How does Access know a message has been received via the ADO connection? Does Access somehow moniter the connection?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
hapiboodaAuthor Commented:
According to MS TechNet: "ADO uses an errors object and errors collection to return standard error information such as SQLSTATE, native error number, and the error message string. These are the same as their ODBC counterparts."
0
 
tliottaCommented:
Minor note... It's almost certain that you will not want the QSYSOPR message queue allocated to some Windows function. Usually this message queue should never be allocated to _any_ process except an actual QSYSOPR interactive session.

Allocation to an external process can interfere with usage of that message queue for system operation tasks. Sooner or later, there will be a conflict.

Tom
0
 
hapiboodaAuthor Commented:
I agree with you tliotta.  I am only interested in receiving a message in Access that tells the user there is a message waiting in QSYSOPR.  I do not want to send the reply through Access to QSYSOPR.

If Access can receive a message from QSYSOPR, I'd like the VB function to exit and display a message box indicating a message is in QSYSOPR waiting on a reply.  I don't want the ADO connection to remain open waiting on a reply.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
<According to MS TechNet: blah blah>

Yes, but errors only occur in response to something (at least in a perfect world <g>) ... at some point, Access/VB/ADO must do _something_ in order for an error to occur. If you open an ADO connection and constantly moniter the Errors collection, you might be able to determine what is occurring, but I'm not an AS/400 expert by any means so don't know what you should look for. My point was simply - how does Access receive the "message" ... I understand you'll have a connection to the database, but how does that connection receive messages? In VB/Access you'd need to moniter the connection in some way (i.e. use a Form Timer and loop through, checking the Errors collection to see what's happening).

0
 
tliottaCommented:
hapibooda:

Then the issue is that an Access/ADO function causes a message to QSYSOPR. In an interactive session, for example, this would result in a message back that session that "Message needing reply sent to QSYSOPR". Such a message would be visible in that case; but in a batch process, there is no clear visibility. You're looking to locate that message that directs the user to QSYSOPR.

Okay, much clearer. Interesting question. I'll see if I can track it down if no one knows off the top of their head.

Tom
0
 
hapiboodaAuthor Commented:
I added a generic MONMSG routine to the called CL program.  Now the CL program escapes if any defined message is encountered and sends a message to the Access application.

I created a MSGBOX in the Access module that instructs the user to check QSYSOPR for messages.

Many thanks for the help.
0
 
Vee_ModCommented:
Closed, 250 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now