|
Thank you for all the responses.--
Is there a chance someone could send or post some code for creating such a Service Program?
Also if there is any further discussion about the problems of the call stack that was mentioned with using
Procedures that are used by other programs (as a separate module)?
________________________________
From: Chamara Withanachchi <chamaraw@xxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, January 7, 2009 3:08:35 AM
Subject: Re: Some ILE questions.
*Procedure*
Subprocedures are independently callable routines in a module. Here are some
of the characteristics of subprocedures:
- They can accept parameters and return values.
- They can have their own variables, separate from the rest of the
program.
- They can be called independently.
- They can return values to be used in expressions.
Many usersfind it easiest to think of subprocedures as "subroutines with
parameters." In other words, subprocedures are small pieces of code (like
subroutines), except that you can call them and pass parameters to them.
also procedures like functions in C/C++
*Prototyping Procedures*
Compiler can validate parameters pass to Procedures
*Export/Import*
EXPORT keyword allows a globally defined data structure or standalone field
defined within a module to be used by another module in the program. The
storage for the data item is allocated in the module containing the EXPORT
definition.. The external_name parameter, if specified, must be a character
literal or constant.
The EXPORT keyword on the definition specification is used to export data
items and cannot be used to export procedure names. To export a procedure
name, use the EXPORT keyword on the procedure specification
The following restrictions apply when EXPORT is specified:
- Only one module may define the data item as exported
- You cannot export a field that is specified in the Result-Field entry
of a PARM in the *ENTRY PLIST
- Unnamed data structures cannot be exported
- BASED data items cannot be exported
- The same external field name cannot be specified more than once per
module and also cannot be used as an external procedure name
- IMPORT and EXPORT cannot both be specified for the same data item.
IMPORT keyword specifies that storage for the data item being defined is
allocated in another module, but may be accessed in this module. The
external_name parameter, if specified, must be a character literal or
constant.
The following restrictions apply when IMPORT is specified:
- The data item may not be initialized (the INZ keyword is not allowed).
The exporting module manages all initialization for the data.
- An imported field cannot be defined as a compile-time or prerun-time
array or table, or as a data area. (Keywords CTDATA, FROMFILE, TOFILE,
EXTFMT, PERRCD, and DTAARA are not allowed.)
- An imported field may not be specified as an argument to the RESET
operation code since the initial value is defined in the exporting module.
- You cannot specify an imported field in the Result-Field entry of a
PARM in the *ENTRY PLIST.
- You cannot define an imported field as based (the keyword BASED is not
allowed).
- This keyword is not allowed for unnamed data structures.
- The only other keywords allowed are DIM, EXTNAME, LIKE, OCCURS, and
PREFIX.
- The same external field name cannot be specified more than once per
module and also cannot be used as an external procedure name.
On Wed, Jan 7, 2009 at 6:45 AM, Adam West <adamster@xxxxxxxxxx> wrote:
HI In ILE, I have had trouble understanding some of these concepts.
the Procedure, is the same as a subroutine? except for the fact that you
can pass parameters and have different data types?
What is the purpose of prototyping Procedures?
What does the Export and Import do?
Typically the Procedure is bound or is it brought in via a /Copy directive?
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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-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.