|
Thanks for all of the help, I now understand why it is important to keep the procedure definitions seperate from the main program. Justin Houchin Programmer Reliatek, Inc ----- Original Message ----- From: "Joel R. Cochran" <jrc@masi-brac.com> To: <rpg400-l@midrange.com> Sent: Wednesday, April 17, 2002 9:51 AM Subject: RE: Sub Procedures > I think you have to view it in terms of scope. One nice thing about being > able to do sub-procedures is that you now define local variables instead of > global variables. If you have a main program that uses the variable > 'Count', your sub-procedure can also use a variable named 'Count' and never > worry about overriding what is in the main program. > > A procedure can use global variables if it (the procedure) is defined > internally in the main program or it can define it's own local variables. > > Now imagine what would happen if what you are looking for were possible: I > have main program A with a field 'Count' defined as 5,0. Main program B > also defines it, but as 7,0. Both program callp sub-procedure C which needs > 'Count'. If the compiler had any way of finding the definition in the first > place (which it can't), then how would it know which one to use? It's a > moot point anyway because neither A nor B will compile without the C object > being compiled and bound to it. > > In other words, "It's not a bug it's a feature!" :-) > > Joel R. Cochran > Director of Internet Services > VamaNet.com > (800)480-8810 > mailto:webmaster@vamanet.com > > > > -----Original Message----- > > From: Justin Houchin [mailto:jhouchin9@charter.net] > > Sent: Wednesday, April 17, 2002 9:34 AM > > To: rpg400-l@midrange.com > > Subject: Re: Sub Procedures > > > > > > So what you are telling me is that I have to define them > > twice? And if so, > > is there another way to accomplish what I',m trying to do > > without defining > > it twice. > > > > > > Justin Houchin > > Programmer > > Reliatek, Inc > > ----- Original Message ----- > > From: "Peter Colpaert" <Peter.Colpaert@honda-eu.com> > > To: <rpg400-l@midrange.com> > > Sent: Wednesday, April 17, 2002 8:20 AM > > Subject: Re: Sub Procedures > > > > > > > > > > Justin, > > > > > > I think it's because the compiler needs to know the field > > definition at > > > compile time, and AFAIK there is no way to tell the > > compiler that this > > > module will be used in this or that RPG program. > > > > > > HTH, > > > > > > Peter Colpaert > > > Application Developer > > > > > > Honda Europe NV > > > Langerbruggestraat 104 > > > B-9000 GENT > > > Peter.Colpaert@honda-eu.com > > > Tel: +32 9 2501 334 > > > Fax: +32 9 2501 231 > > > ---------- > > > Program documentation is like sex: when it is good, it is > > very, very good; > > > and when it is bad, it is better than nothing. > > > ---------- > > > > > > > > > > > > > > > Justin Houchin <jhouchin9@charter.net>@midrange.com on > > 17/04/2002 15:23:26 > > > Please respond to rpg400-l@midrange.com > > > Sent by: rpg400-l-admin@midrange.com > > > > > > To: RPG Midrange <rpg400-l@midrange.com> > > > > > > cc: > > > > > > Subject: Sub Procedures > > > > > > > > > This is a multi-part message in MIME format. > > > -- > > > [ Picked text/plain from multipart/alternative ] > > > Hi Everyone, > > > How come when you create a NOMAIN sub procedure that > > you have to set > > up the definitions for a field you are going to use twice? > > Why can't the sub > > > procedure use the same definitions that are already > > specified in the RPG > > Program? > > > > > > > > > > > > Justin Houchin > > > Programmer > > > Reliatek, Inc > > > _______________________________________________ > > > 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. > > > > > > > > > > > > > > > > > > > > > > > ______________________________________________________________________ > > > The information contained in this communication is > > confidential and may be > > > legally privileged. It is intended solely for the use of > > the individual or > > > the entity to whom it is addressed and others authorised to > > receive it. If > > > you have received it by mistake, please let the sender know > > by e-mail > > reply > > > and delete it from your system. > > > If you are not the intended recipient you are hereby > > notified that any > > > disclosure, copying, distribution or taking any action in > > reliance of the > > > contents of this information is strictly prohibited and may > > be unlawful. > > > Honda Europe NV is neither liable for the proper and > > complete transmission > > > of the information contained in this communication nor for > > any delay in > > its > > > receipt. > > > > > > _______________________________________________ > > > 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 mailing list archive is Copyright 1997-2025 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.