× 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.



I have many routines that I have never gotten around to converting to
/free-format for one reason or another. In new programs, which are always
/free-format, I just figured (didn't RTFM as Paul did) that I had to use the
/end-free directive in the base program and then, of course, issue the /free
directive after the copy to switch back.

I thought that the compiler built the source to be compiled (i.e., copied in
any copy books) before it started its syntax checking phase. That is, if I
have a program that is totally /free-format calcs, and if I wanted to copy
in a member that is, also, /free-format, that all I would have to do is
issue the /copy directive with no /free directive in either the base program
or the copy book. But from the way I read the excerpt from the manual, that
wouldn't work. That's what surprises me, though I couldn't find any such
discrete example in my code.

I do have several members that use /IF /ENDIF directives that typically copy
in the D-specs in one part and the Calcs in another part. For whatever
reason, I always put the /free directive at the beginning of Calcs (probably
thinking it might be used in a fixed-format program). I just tested one of
those routines and, sure enough, it copied in the calcs portion of the copy
book, but gave me an error because the form-type (column 6) was invalid
(i.e., blank). So the /free directive must be in the copy book in these
cases. In David's case, it would seem, the /end-free directive in the main
program is superfluous; I'm guessing here that the /free is, also,
superfluous, but couldn't find any samples that I could modify for a quick
test.

Jerry C. Adams
IBM i Programmer/Analyst
Belgium is just a country invented by the British to annoy the French.
-Charles de Gaulle
--
A&K Wholesale
Murfreesboro, TN
615-867-5070


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Morgan, Paul
Sent: Thursday, May 19, 2011 10:08 AM
To: RPG programming on the IBM i / System i
Subject: RE: /copy surprise

David,

From the RPG reference manual describing /copy:

/COPY members are considered fixed-form by default, even if the /COPY
directive is coded within a free-form group. If the /COPY member will
contain free-form specifications, these must be delimited with /FREE and
/END-FREE directives.

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of David Gibbs
Sent: Thursday, May 19, 2011 10:55 AM
To: RPG programming on the AS400 / iSeries
Subject: /copy surprise

Folks:

I ran into something that surprised me recently.

I have some free form code that I put a /copy in the middle of ... the code
that's being copied in is fixed form.

The compiler didn't complain that I switched from free form to fixed form
with the '/end-free', '/copy', '/free'.

Obviously I'm not complaining ... it just surprised me.

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.