× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On 12/01/2010, at 1:27 AM, Vern Hamberg wrote:

Using subprocedures - in fact, this might be better justification for
making everything free.

Ah ... I was thinking of multiple occurrences of /FREE and /END-FREE within the body of C-Specs; not just at the start and end of each block of C-Specs. I don't find coding /FREE and /END-FREE around a procedure body particularly onerous or ugly but I certainly wouldn't mind if I didn't have to do that.

The solution is not a fully free-form RPG but rather an H-Spec that indicates all C-Specs will be free-form e.g., CSPEC( *FIXED | *FREE ). *FIXED is the default and gives current behaviour. *FREE simply implies /FREE before the first C-Spec and /END-FREE after the last C- Spec. The first C-spec is the occurrence of a line where columns 6 & 7 are empty and a valid op-code is found. The last C-Spec of a group is given by the occurrence of a specification identifier.

The compiler can add the /FREE and /END-FREE while reading the source to make parsing easier.

Further, this H-Spec keyword should not preclude the user adding /END- FREE and /FREE as required if they need to drop out of free-format for some operation. This would be similar behaviour to file open handling. Even without USROPN I can CLOSE and OPEN a file.

Thus:

H CSPEC(*FREE)
H DFTACTGRP(*NO) ACTGRP(*CALLER)

D proc1 PR 5I 0
D parm1 10 CONST OPTIONS(*NOPASS)
D proc2 PR 5I 0
D parm1 10 OPTIONS(*OMIT)
D proc3 PR 5I 0
D parm1 10 OPTIONS(*NOPASS:*OMIT)

CALLP proc1;
CALLP proc2(*OMIT);
CALLP proc3;
EVAL *INLR = *ON;
RETURN;

P proc1 B
D proc1 PI 5I 0
D parm1 10 CONST OPTIONS(*NOPASS)
IF %PARMS > 0;
ENDIF;
/END-FREE
C NEEDLE:X SCAN HAYSTACK:Y FOUND
/FREE
RETURN 1;
P proc1 E

P proc2 B
D proc2 PI 5I 0
D parm1 10 OPTIONS(*OMIT)
IF %PARMS > 0 AND %ADDR(parm1) <> *NULL;
ENDIF;
RETURN 2;
P proc2 E

P proc3 B
D proc3 PI 5I 0
D parm1 10 OPTIONS(*NOPASS:*OMIT)
IF %PARMS > 0 AND %ADDR(parm1) <> *NULL;
ENDIF;
RETURN 3;
P proc3 E


In fact, I thought something similar had already been proposed for RPG.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.