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



I recommend that you use USROPN

You should test for file open instead of opening and closing all the time.

i.e IF %OPEN



>>> dleland@Harter.com 03/07/02 01:06PM >>>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
I am very curious about this as well because I created a SRVPGM with a file
and didn't specify USROPN (and didn't do any explicit OPENs or CLOSEs).  I
also didn't seton LR when exiting the SRVPGM (leaving the files open) and
this caused problems - I don't recall the exact message but it was an MCH
message and it indicated that the SRVPGM (or resources) was destroyed.  So,
I changed the program to USROPN and explicitly OPENed the file upon entry
into the SRVPGM and explicitly CLOSEed it after using it.  I don't like
doing this because it burns more CPU time but it took care of the problem.

Dave

-----Original Message-----
From: Andrew Lutz [mailto:alutz@pmigroup.com]
Sent: Thursday, March 07, 2002 4:00 PM
To: rpg400-l@midrange.com
Subject: RE: SRVPGM: USROPN file or not


Wrong, as you observed it will be opened automatically

What the compiler is warning you about is the need to close the file
'manually' (if that is what you want to do) because you have NOMAIN.


>>> marcin.drozdowski@big.pl 03/07/02 12:42PM >>>
So Service PGM shouldn't open a file automatically, when no USROPN
is specified, right? (Because it have no RPG cycle embedded)
But it does, during first call. I've checked it.

Marcin Drozdowski

-----Original Message-----
From: Bob Cozzi (RPGIV) [mailto:cozzi@rpgiv.com]
Sent: Thursday, March 07, 2002 9:18 PM
To: rpg400-l@midrange.com
Subject: RE: SRVPGM: USROPN file or not


User Controlled Open (USROPN) gives you the ability to avoid having RPG
IV automatically open the file for you, using the RPG cycle.

Service program do not have an RPG Cycle embedded in them.

The ability to use the OPEN and CLOSE operation codes has nothing to do
with the USROPN keyword. A file could be opened outside of the program
or in your case, Service program.

Bob Cozzi
cozzi@rpgiv.com
Visit the on-line  Midrange  Developer  forum at: http://www.rpgiv.com

> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On
> Behalf Of Andrew Lutz
> Sent: Thursday, March 07, 2002 1:49 PM
> To: rpg400-l@midrange.com
> Subject: Re: SRVPGM: USROPN file or not
>
> Would you ever want to close the file?
>
> If the answer is yes, then USROPN is the way to go.
>
>
>
> Andrew Lutz
> Database Administrator
> (916) 851-7140
> alutz@pmigroup.com
>
>
> >>> marcin.drozdowski@big.pl 03/07/02 11:40AM >>>
> Procedure in my SRVPGM is called frequently, both from batch (server)
> and interactive jobs. RPGLE programs are running in named activation
group.
> IMHO it's good idea _not_ to declare files in SRVPGM with USROPN, but
> compiler says: "Files should be closed explicitly when NOMAIN is
> specified on the Control specification".
> The message has severity 10 and SRVPGM is created.
> Will it have any bad influences?
>
> Thanks for advice.
> Marcin Drozdowski
>
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.