Alan,

Roman's example cited below works. (You can also handle what the specific
archived message was after by separating storage into the WORKING-STORAGE
AND LOCAL-STORAGE sections.) You also don't have to code a RETURNING
phrase on your calls--nothing wrong with doing it, but it isn't required.
You can just pass parameters like any other call. You can also specify
OMMITED for parameters you are not passing--although coding for omitted
parameters is a little cumbersome in a subprogram/subprocedure. It's been
a little while since I wrote one but if I recall correctly, data declared
in a main or outer procedure is available to the sub procedures without
specifying it in the USING phrase. You can find information on all of
this in the ILE COBOL Language Reference and the ILE COBOL Programmer's
Guide. These are available in WDSC/RDi or in the Information Center at:
http://tinyurl.com/y8msc8h for V5R4 or http://tinyurl.com/yajlxnm for
V6R1. You may also find the ILE Concepts manual very helpful V5R4:
http://tinyurl.com/ys9fzl or Version 6.1: http://tinyurl.com/y86pmt5

Michael Quigley

cobol400-l-bounces@xxxxxxxxxxxx wrote on 09/30/2009 01:00:12 PM:

----- Message from RMiklos@xxxxxx on Wed, 30 Sep 2009 09:12:18 +0200
-----

To:

COBOL Programming on the iSeries/AS400 <cobol400-l@xxxxxxxxxxxx>

Subject:

Re: [COBOL400-L] Procedure equivalent in Cobol

In normal COBOL you have only sections and paragraphs.

But in ILE COBOL you can:

1. Create a module, where you define a procedure or function with

PROCEDURE DIVISION
USING argument
RETURNING result

2. Place your module with the procedure in a service program

3. call the procedure/function from an other module using
CALL PROCEDURE procname
USING argument
RETURNING INTO result

Here is an example from the archive of this mailing list:
http://archive.midrange.com/cobol400-l/200512/msg00024.html





From:
steelville <steelville@xxxxxxxxxxx>
To:
COBOL Programming on the iSeries/AS400 <cobol400-l@xxxxxxxxxxxx>
Date:
30.09.2009 01:59
Subject:
[COBOL400-L] Procedure equivalent in Cobol
Sent by:
cobol400-l-bounces@xxxxxxxxxxxx



Guys,
I just joined a mixed-code shop, and there's plenty of RPG but most of
the code is Cobol. I know Cobol but I hate spelling it with all caps.

And I poked around in the manuals but can't get clear how ILE is
implemented in Cobol. Could I get direction on this. All I can find so
far is about either CRTBNDCBL and compiling one source member to one
module.

I'd like to know if there's an equivalent to RPG's subprocedures and all

that...

--Alan

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 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.