I know this is not a problem with RPG III, and in many cases not a problem
with RPG IV. But when I am using ACTGRP(*CALLER) or even named activation
groups, and particularly when I am using linear main procedures files are
not always opened automatically. I know that it is because the Cycle is not
involved, and the easy fix is to include an open block in a program
initialization procedure that looks like this:
if not %open(filename);
This avoids file open problems like trying to access a file that is not
open. But when I have a lot of files, I get tired of writing that same code
block over and over.
The Java editor for eclipse can generate getters and setters. You select
Source -> Generate Getters and Setters from the right click menu, select
the getters and setters you want in the resulting dialog, and click
Generate. The class gets the getters and setters that you just asked for.
LPEX could do that for file opens. Select New -> Generate File Opens,
Select files to generate opens for from the resulting dialog, click
Generate, and the above open block is generated for each of the files you
selected in the dialog. It could be that easy. Snippets get me close, but
are a one at a time thing, and I don't see the outline and the snippet
dialog at the same time since they are tabs in the same view. So I end up
bouncing back and forth. Just extra busy work. So for now I only update
programs that exhibit the error behavior. But that doesn't really fix
things all the way, it's just a band aid.
I submitted an RFE to auto generate file open code as a helper in RDi. You
can find it here.
As an Amazon Associate we earn from qualifying purchases.