Bueno... pues forzaré un RTFM (Read The Fucking Manual ;-) con un BEAF
(Breve Explicación Al Final ;-)
En RPGLE (del manual de versión 4 del BookManager ILE RPG for AS/400
Reference Version 4 Document Number SC09-2508-00)
4.4.12 CALLP (Call a Prototyped Procedure or Program)
┌───────────────┬────────────────┬──────────────────────────────────────────────────┐
│ Code │ Factor 1 │ Extended Factor 2
│
├───────────────┼────────────────┼──────────────────────────────────────────────────┤
│ CALLP (E M/R) │ │ NAME{ (Parm1 {:Parm2...}) }
│
└───────────────┴────────────────┴──────────────────────────────────────────────────┘
The CALLP operation is used to call prototyped procedures or programs.
Unlike the other call operations, CALLP uses a free-form syntax. You use
the extended-factor 2 entry to specify the name of the prototype of the
called program or
procedure, as well as any parameters to be passed. (This is similar to
calling a built-in function.) A maximum of 255 parameters are allowed for a
program call, and a
maximum of 399 for a procedure call.
The compiler then uses the prototype name to obtain an external name, if
required, for the call. If the keyword EXTPGM is specified on the
prototype, the call will be a
dynamic external call; otherwise it will be a bound procedure call.
A prototype for the program or procedure being called must be included in
the definition specifications preceding the CALLP.
Note that if CALLP is used to call a procedure which returns a value, that
value will not be available to the caller. If the value is required, call
the prototyped
procedure from within an expression.
To handle CALLP exceptions (program status codes 202, 211, or 231), the
operation code extender 'E' can be specified. For more information on error
handling, see
"Program Exception/Errors" in topic 1.5.2.
Note: The E extender is only active during the final call for CALLP. If an
error occurs on a call that is done as part of the parameter processing,
control will not pass
to the next operation. For example, if FileRecs is a procedure
returning a numeric value, and an error occurs when FileRecs is called in
the following statement,
the E extender would have no effect.
CALLP (E) PROGNAME(FileRecs(Fld) + 1)
For more information on call operations, see "Call Operations" in topic
4.3.5. For information on how operation extenders M and R are used, see
"Precision Rules for
Numeric Operations" in topic 4.2.6.
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│
│
│
│
│ *-------------------------------------------------------------
│
│ * This prototype for QCMDEXC defines two parameters:
│
│ * 1- a character field that may be shorter in length
│
│ * than expected
│
│ * 2- any numeric field
│
│ *-------------------------------------------------------------
│
│ D qcmdexc PR EXTPGM('QCMDEXC')
│
│ D cmd 200A OPTIONS(*VARSIZE) CONST
│
│ D cmdlen 15P 5 CONST
│
│ ...
│
│ C CALLP QCMDEXC('WRKSPLF' :
│
│ %size ('WRKSPLF'))
│
│
│
│
│
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
Figure 195. Calling a Prototyped Program Using CALLP
En CLLE (del CL Reference Version 4 Document Number SC41-5722-01 )
3.1.102 CALLPRC (Call Bound Procedure) Command
Mod: B,I
>>──CALLPRC──PRC(──procedure-name──)──>
<─────────────────────────────────┐
(1)
>───┬───────────────────────────────┬┴──────>
>
└─PARM(──┬─*OMIT───────────┬──)─┘
└─parameter-value─┘
(P)
>──┬──────────────────────────────────────┬──────><
>
│ ┌─*NONE────────────────┐ │
└─RTNVAL(──┴─return-variable-name─┴──)─┘
Notes:
(1) A maximum of 300 repetitions.
(P) All parameters preceding this point can be specified in positional
form.
──────────────────────────────────────────────────────────────────────────
Purpose
The Call Bound Procedure (CALLPRC) command calls a bound procedure named on
the command, and passes control to it. Optionally, the procedure issuing
the
CALLPRC command can pass parameters to the called procedure. The CALLPRC
command can be used in compiled ILE control language (CL) programs and
modules. Upon return, the return code from the called procedure will be
placed in the RTNCDE parameter if specified.
Each parameter value passed to the called procedure can be a character
string constant, a numeric constant, a logical constant, a floating-point
constant, or a CL
program variable. If a floating-point constant is specified, the value is
converted to double-precision format and passed to the called program. If
parameters are
passed, the value of the constant or variable is available to the program
that is called. Parameters cannot be passed in any of the following forms:
lists of values,
qualified names, expressions, or keyword parameters. Up to 300 parameters
can be passed to the called procedure.
Note: Although the CALLPRC command will allow up to 300 parameters to be
passed, the number that the called procedure can accept will depend on the
language
of the called procedure. For example, a CL procedure cannot accept
more than 40 parameters.
If parameters are passed to a procedure using the CALLPRC command, the
values of the parameters are passed in the order in which they appear on
the CALLPRC
command; this order must match the order in which they appear in the
parameter list in the calling procedure.
Parameters in a called procedure can be used in place of its variables.
However, no storage in the called procedure is associated with the
variables it receives.
Instead, if a variable is passed, the storage for the variable is in the
procedure in which it was originally declared. If a constant is passed, a
copy of the constant is
made in the calling procedure and that copy is passed to the called
procedure.
The result is that if a variable is passed, the called procedure can change
its value and the change is reflected in the calling procedure. If a
constant is passed, and
its value is changed by the called procedure, the changed value is not
known to the calling procedure. Therefore, if the calling procedure calls
the same procedure
again, the values of constants are set to their original values, but the
variables do not change.
Note: To see the parameter and value descriptions for this command, refer
to the online help text. For more information about printing the help
text, refer to "Printing
CL Command Descriptions" in Chapter 1.
Examples
Example 1: Calling a Procedure
CALLPRC PRC(PAYROLL)
The procedure named PAYROLL is called with no parameters being passed to
it. The PAYROLL procedure does not return a value
Example 2: Defining a Character Constant
CALLPRC PRC(PAYROLL) PARM('1')
The procedure named PAYROLL is called with a character constant passed as a
quoted string. The PAYROLL procedure does not return a value
Example 3: Passing Parameters
CALLPRC PRC(PAYROLL) PARM(CHICAGO 1234 &VAR1) RTNVAL(*NONE)
The procedure named PAYROLL. The calling procedure passes three
parameters: a character string (CHICAGO), a decimal value (1234.00000),
and the contents of
the CL variable &VAR1. The attributes of the variable determine the
attributes of the third parameter. The PAYROLL procedure does not return a
value.
Example 4: Calling Procedure with Floating-Point Values
CALLPRC PRC(PRC1) PARM(1.5E3 *INF) RTNVAL(&RVAL)
The procedure named PRC1 is called with two double-precision floating-point
values being passed to it. The returned value is stored in variable &RVAL.
Example 5: Ignoring the Return Value of a Procedure
CALLPRC PRC(PRC1) PARM(1.5E3 *INF) RTNVAL(*NONE)
The procedure named PRC1 is called with two double-precision floating-point
values being passed to it. The returned value is ignored and therefore
unavailable to
the calling procedure.
Example 6: Calling a Procedure that Returns a Binary Number
CALLPRC PRC(RTNINT) RTNVAL(% BIN($RTNV 1 4))
The procedure named RTNINT returns a 4-byte binary value. It is stored in
the first four bytes of variable $RTNV. Variable &RTNV is of type *CHAR
and has a length
of at least 4.
BEAF:
Con CALLP puedes llamar a procedimientos internos o enlazados (bounded
segun IBM linked segun el resto de la humanidad) si defines el prototipo,
mientras que con CALLB sólo los enlazados.
Con CALLPRC sólo puedes llamar a procedimientos enlazados, de ahí que
comentara que en parte CALLP y CALLPRC eran similares, CALLP puede hacer lo
mismo que CALLPRC y más cosas (llama a procedimientos internos)
fins aviat...
Àlex Corretgé
[EMAIL PROTECTED]@QUIJOTE.COMBIOS.ES
04/10/2002 08:52
Por favor, responda a [EMAIL PROTECTED]
Tramès per: [EMAIL PROTECTED]
Destinataris: [EMAIL PROTECTED]
Còpia:
Classificat: |----------------|
| ( ) Important |
| ( ) urgent |
| ( ) històric |
| ( ) temporal |
| ( ) bretolada |
| ( ) particular |
|----------------|
Assumpte: RE: Llamada a modulos (Document link: Alex Corretge)
Nada de perdonarte ;-) ya haces bi=E9n de creer que un CALLPRC equivale=
a un
CALLP en RPG=2E=2E=2E en parte=2E
fins aviat=2E=2E=2E
=C0lex Corretg=E9
"Alberto" <alberto@arcadie=2Ees>@QUIJOTE=2ECOMBIOS=2EES con fecha 02/10=
/2002
17:57:12
Por favor, responda a forum=2Ehelp400@combios=2Ees
Tram=E8s per: erroreshelp400@QUIJOTE=2ECOMBIOS=2EES
Destinataris: <forum=2Ehelp400@combios=2Ees>
C=F2pia:
Classificat: |----------------|
| ( ) Important |
| ( ) urgent |
| ( ) hist=F2ric |
| ( ) temporal |
| ( ) bretolada |
| ( ) particular |
|----------------|
Assumpte: RE: Llamada a modulos
Ok=2E Perdonad=2E Estaba convencido que el CALLPRC equival=EDa al CALLP=
del
RPGLE=2E
-----Mensaje original-----
De: forum=2Ehelp400-request@combios=2Ees
[mailto:forum=2Ehelp400-request@combios=2Ees]En nombre de
Alex=2ECorretge@Frape=2EBehrgroup=2ECOM
Enviado el: mi=E9rcoles 2 de octubre de 2002 17:13
Para: forum=2Ehelp400@combios=2Ees
Asunto: Re: Llamada a modulos
Prueba con CALLPRC
fins aviat=2E=2E=2E
=C0lex Corretg=E9
"Alberto" <alberto@arcadie=2Ees>@QUIJOTE=2ECOMBIOS=2EES con fecha 02/10=
/2002
16:01:50
Por favor, responda a forum=2Ehelp400@combios=2Ees
Tram=E8s per: erroreshelp400@QUIJOTE=2ECOMBIOS=2EES
Destinataris: <forum=2Ehelp400@combios=2Ees>
C=F2pia:
Classificat: |----------------|
| ( ) Important |
| ( ) urgent |
| ( ) hist=F2ric |
| ( ) temporal |
| ( ) bretolada |
| ( ) particular |
|----------------|
Assumpte: Llamada a modulos
Hola Foro=2E Una pregunta tonta:
Tengo un PGM en Ile, y quiero crear dentro un m=F3dulo en CLLE que a=F1=
ada unas
bibliotecas y llame a otro m=F3dulo en RPGLE, pero NO SOY CAPAZ de llam=
ar a
un m=F3dulo RPGLE desde una CLLE=2E
Si no se hace as=ED, =BFC=F3mo lo hac=E9is vosotros?
Gr=E0cies i A10=2E
_____________________________________________________
Forum=2EHELP400 es un servicio m=E1s de NEWS/400=2E
=A9 Publicaciones Help400, S=2EL=2E - Todos los derechos reservados
http://www=2Ehelp400=2Ees
_____________________________________________________
Para darte de baja, env=EDa el mensaje resultante de pulsar
mailto:forum=2Ehelp400-request@combios=2Ees?body=3DLEAVE
_____________________________________________________
Forum=2EHELP400 es un servicio m=E1s de NEWS/400=2E
=A9 Publicaciones Help400, S=2EL=2E - Todos los derechos reservados
http://www=2Ehelp400=2Ees
_____________________________________________________
Para darte de baja, env=EDa el mensaje resultante de pulsar
mailto:forum=2Ehelp400-request@combios=2Ees?body
_____________________________________________________
Forum=2EHELP400 es un servicio m=E1s de NEWS/400=2E
=A9 Publicaciones Help400, S=2EL=2E - Todos los derechos reservados
http://www=2Ehelp400=2Ees
_____________________________________________________
Para darte de baja, env=EDa el mensaje resultante de pulsar
mailto:forum=2Ehelp400-request@combios=2Ees?body=3DLEAVE
=
_____________________________________________________
Forum.HELP400 es un servicio más de NEWS/400.
© Publicaciones Help400, S.L. - Todos los derechos reservados
http://www.help400.es
_____________________________________________________
Para darte de baja, envía el mensaje resultante de pulsar
mailto:[EMAIL PROTECTED]?body=LEAVE
��q?�4z˧���Ȩ��^4E���4>��Ɯ��ްw���4H��v�%��^��!��ޱ��i�,��i��0����4z�ڭ�Z�םy��i��i�fz{���mj{^u�n�ƫ�������zZx�Jު笵�&n*,z��w"�Q