× 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 13/03/2010, at 8:07 AM, Florin Todor - YYZ Concord wrote:

Oh, yeah? Check out this one (real, production program):

C *inzsr begsr

C *in99 ifeq *on

C *in99 andeq *off
C open dsl08001
C read dsl08001
99


That's just a "modern" example of

C LRNLR OPEN ...
C LRNLR READ ...

Not sure why the OPEN would be in there but an impossible READ or UPDATE is usually done to satisfy the RPG III compiler's requirement for at least one I/O op-code for each operation supported by the specified file type. For example, if you specify type I then you must have a READ, if you specify type O then you must have a WRITE, if you specify type U you must have an UPDATE. When using a shared ODP the first program to open the file must ensure it is opened with the correct type for all subsequent operations (i.e., if the first open is for a shared input ODP then subsequent shared opens cannot open for update). Because the RPG III compiler would fail if a program did not include I/O operations for each of the open possibilities it was common to trick the compiler by coding the operation (e.g., UPDATE) in an impossible condition. This allowed the program to compile but the operation code would never run.

This code:
FADRBOOKPUF E K DISK A
C SETON LR

fails with:
* 7024 100 NO CALCULATION SPECIFICATIONS REFER TO FILE ADRBOOKP INPUT SPECIFICATIONS.
(missing READ)
* 7063 100 ADD SPECIFIED FOR FILE ADRBOOKP BUT NO WRITE OR ADD SPECIFICATION FOUND.
(missing WRITE)
* 7064 100 ADRBOOKP FILE NOT REFERENCED FOR UPDATE.
(missing UPDATE or DELETE)

But this code compiles fine (won't do anything though):
FADRBOOKPUF E K DISK A
C LRNLR READ ADR 99
C LRNLR WRITEADR
C LRNLR UPDATADR
C SETON LR

Perhaps the author did not realise such tricks are no longer necessary with RPG IV? Perhaps someone has converted an RPG III program to RPG IV and did not remove this unnecessary code? Perhaps it is a way of "removing" a code block instead of commenting-out or deleting all the lines?

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

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.