On 25-Feb-08, at 2:40 PM, rpg400-l-request@xxxxxxxxxxxx wrote:

1) How to build proc1 into a COBOL prototype that could be /COPY'd into a
COBOL program

There is sadly no such thing as prototyping in COBOL - at least not in the ILE version.

2) How to build a data structure and then reference it using something
similar to our LIKEDS (I saw COBOL has the LIKE keyword and I have been
playing around with that).

D ds1 ds qualified inz
D fld1 1024a varying
D fld2 10a
D fld3 10i 0
D fld4 30a varying

Translates to something like this: In a hurry so ....

01 ds1.
05 fld1.
10 fld1-len Pic s9(4) comp-4.
10 fld1-data Pic x(1024).
05 fld2 Pic x(10).
05 fld3 Pic s9(9) comp-4.
05 fld4.
10 fld4-len Pic s9(4) comp-4.
10 fld4-data Pic x(30).

I thought COBOL had done varying length properly by now but I see nothing in the manual.


3) Show an example of calling this sub procedure from a mainline.

Just an example - haven't time for the whole thing. Will add comments to your proto to explain the problems.

call procedure "abc" using x by value, y, z returning answer.

D proc1 pr 3 0
D pParm1 10a const
*** No equivalent to const - what you pass _must_ be the right size/ type BUT you _can_ insist that only a copy ins passed "xyz by copy" I think.

D pParm2 15P 0 value options(*omit)

*** No *Omit equivalent - up to you to pass a null pointer when needed.

D pParm3 z value

*** See example above.

D pParm4 128a value varying
*** See example of varying length definition above _you_ must set the length!

D pParm5 n value
*** Indicators are just single character fields i.e. Pic x.

D pParm6 like(fld1)
D pParm7 likeds(ds1) options(*nopass)
*** Don't think there is a like DS. You can use LIKE at any level but it will give a big blob - no individual fields.

D pParm8 * procptr value options (*nopass)
*** Can't recall the syntax but it is there.

4) Show an example of defining/coding a local sub procedure.


There really aren't any. For ones to be used within a program look for Nested programs. For independently compiled subprocedures just compile as a module. Since they don't have a cycle etc. like RPG there is no need for NOMAIN etc.
Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



This thread ...


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

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