|
That's what I was trying to figure out. Compiling as a service program I
get
the same error, return value not allowed for the main procedure
FCodeFF00 if e k disk
d CODE001R PR 1n
d cdGroup_ 3s 0 const
d cdCode_ 50a const
d CODE001R PI 1n
d cdGroup_ 3s 0 const
d cdCode_ 50a const
d exists_ like(*in01)
**
chain (cdGroup_:cdCode_) Codeff00r;
if %found;
exists_ = *on;
else;
exists_ = *off;
endif;
return exists_;
Thanks for quick responses...
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff
Young
Sent: Tuesday, January 06, 2015 1:47 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Service programs, procedures, not sure what to do
Jack,
A *program* can not return data.
If you need to return data from another program, define the return field a
parameter in the caller and called program.
If you create a service program with your procedure, that can return a
parameter with no problem.
Jeff Young
Sr. Programmer Analyst
On Tue, Jan 6, 2015 at 1:38 PM, Jack Tucky < <mailto:jacktucky@xxxxxxxxx>
jacktucky@xxxxxxxxx> wrote:
If I want to put this code in another program, how would I define the
procedure there?
kc2hiz@xxxxxxxxx> wrote:On Jan 6, 2015, at 1:31 PM, Buck Calabro < <mailto:kc2hiz@xxxxxxxxx>
On 1/6/2015 12:29 PM, Jack Tucky wrote:
I tried to code the PR/PI in my first RPG and it says I can't
return a value. Do I need something different? Sorry I'm so
vague. I'm still
not
where I need to be on procedures/service programs, etc.
In order to return a value, you need to tell the procedure interface
(and prototype) that. Here is an example of a procedure that takes
a 10 character 'date' and converts it into an 8 digit number. The
'8s 0'.place where we define what gets returned is on the PI spec; here it's
The actual /value/ that gets returned is in the return statement
(here, unimaginatively called retVal).
* convert 'yyyy-mm-dd' to yyyymmdd
p date10to8 b
d date10to8 pi 8s 0
d date10 10a const
...
d retVal s 8s 0 inz
...
return retVal;
p e
procedure.You'd do something similar with your 'return the next number'
--
--buck
'I had nothing to offer anybody except my own confusion' - Jack
Kerouac
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
RPG400-L@xxxxxxxxxxxx To subscribe,To post a message email: <mailto:RPG400-L@xxxxxxxxxxxx>
unsubscribe, or change list options,
http://lists.midrange.com/mailman/listinfo/rpg400-lvisit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>
RPG400-L-request@xxxxxxxxxxxx Before posting, please takeor email: <mailto:RPG400-L-request@xxxxxxxxxxxx>
a moment to review the archives at
http://archive.midrange.com/rpg400-l.<http://archive.midrange.com/rpg400-l>
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:<mailto:RPG400-L@xxxxxxxxxxxx> RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: <mailto:RPG400-L-request@xxxxxxxxxxxx>RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at <http://archive.midrange.com/rpg400-l>http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: <mailto:RPG400-L@xxxxxxxxxxxx>
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: <http://lists.midrange.com/mailman/listinfo/rpg400-l>
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: <mailto:RPG400-L-request@xxxxxxxxxxxx>
RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
<http://archive.midrange.com/rpg400-l>
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.