|
Sounds like you're trying to create a program. You need to create this
as a module, then make a service program from it, or bind it to another
module to create a program. You could create this as a program by
specifying EXTPGM('MYPGM') on your prototype, but when the program was
executed, the only instruction it would execute is turning *inlr *on.
Mark Walter
Senior Programmer/Analyst
Hainey Business Systems
(717) 718-9601 x7148
mwalter@xxxxxxxxxxx
http://www.hbs-inc.com
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Luqman
Sent: Monday, September 12, 2005 4:07 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Creating a Function in RPG ?
I have copied following code from Internet, but unable to compile.
The error is:
Keyword EXTPGM must be specified when DFTACTGRP(*YES) is
specified on the CRTBNDRPG command.
The Code is:
0001.00 * Prototype for procedure FUNCTION
0002.00 D FUNCTION PR 10I 0
0003.00 D TERM1 5I 0 VALUE
0004.00 D TERM2 5I 0 VALUE
0005.00 D TERM3 5I 0 VALUE
0006.00 C EVAL *INLR = *ON
0007.00 P Function B
0008.00 *-------------------------------------------------------------
0009.00 * This procedure performs a function on the 3 numeric values
0010.00 * passed to it as value parameters.
0011.00 *
0012.00 * This illustrates how a procedure interface is specified for a
0013.00 * procedure and how values are returned from a procedure.
0014.00 *-------------------------------------------------------------
0015.00 D Function PI 10I 0
0016.00 D Term1 5I 0 VALUE
0017.00 D Term2 5I 0 VALUE
0018.00 D Term3 5I 0 VALUE
0019.00 D Result S 10I 0
0020.00 /free
0021.00 Result = Term1 ** 2 * 17
0022.00 + Term2 * 7
0023.00 + Term3;
0024.00 return Result * 45 + 23;
0025.00 /end-free
0026.00 P E
Any idea please, what am I missing ?
I want to create various User-Defined Functions in my SQLRPGILE
programs,
which should return values.
Best Regards,
Luqman
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.