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

probably my understanding of the platform speifics is somewhat weak, so I cannot understand how to solve the problem. May be someone can advise me.

A PC program using Client Access establishes a connection session with AS/400. As a result a job named QZRCSRVS is started.
The PC program establishes environment for this job (creates library list and some other preparations) and then starts calling one and the same program:

CALL H46HMR PARM(PROGNAME, PARM1, PARM2, ....)

H46HMR is a vendor provided ILE RPG program compiled with an activation group attribute *CALLER.

This program actually calls our program named PROGNAME, passes some parameters to it and receiving something in response. It is also compiled as *CALLER.

The problem is in our program.

It does something like:

void main()
{
_RFILE *fp ;

fp = _Ropen("QTEMP/TEMPFILE", "rw") ;
if (fp == NULL)
{
system("CRTDUPOBJ OBJ(TEMPFILE) FROMLIB(MYLIB) TOLIB(QTEMP) OBJTYPE(*FILE)") ;
fp = _Ropen("QTEMP/TEMPFILE"), "wr") ;
}
/* Generating response */
for (.....)
{
.......
_Rwite(fp, ...) ;
}
_Rclose(fp) ;

/*-------------------------------------*/
/* Sending response back */
_Ropen("QTEMP/TEMPFILE", "rr+") ;
_Rreadf(fp, ...)
for (....)
{
_Rdelete(fp) ;
_Rreadn(fp, ...) ;
}
_Rclose(fp) ;
}

When program is called, it first generates a list of records (reply) and then starts sending them back to the caller one by one. It is a predefined logic, works fine.
Now one of our programs of this sort has a bug, that we are searching for a couple of weeks but with no success. As a result the program crashes and the file QTEMP/TEMPFILE left open.

When program is called next time, the file opening command with clearing file content (option "wr") fails because the file is being held by someone. This someone is probably the crashed previous instance....
So from that moment the program works, in the sense that it consumes resources, but does not do what is intended.
Is there something, that can be done inside our program to take care of this situation? Close the file somehow if it was left open or something alike?
I am (of course) not losing the hope to find the original bug, but have no idea how to proceed.

Advise will be highly appreciated :-)

Jevgeni Astanovski


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.