optional/blank Params for include files?

I have an include encapsulating a shared frame being used by 2 separate record structures

myinclude.i

DEFINE {1} SHARED FRAME {2}frame.

FORM
{2}rec.field1
{2}rec.field2
WITH FRAME {2}frame
NO-LABELS
2 DOWN
NO-BOX
CENTERED.


I need both the 1st and 2nd params to be optional

From the Parent Processes, this simply works as:

{ myinclude.i NEW }

or

{ myinclude.i NEW abc-}

However from a Child Process, I don't appear to have the ability to PASS in a BLANK for the 1st param?

{ myinclude.i "" abc- } produces errors:

Unable to understand after -- "DEFINE". (247)
One or more missing keywords in DEFINE statement. (404)


I have tried " ", '', ' ', """", "" "", """""", """ """ ... all produce a similar responses
 
This seems to work for me:
Code:
/* inc.i
 */
define {1} variable c as character no-undo initial "{2}".

display c.

Code:
{inc.i " " "fred"}

BTW -- include files are evil.
 
Dislcaimer: I can only second that in the light of a modern language like the ABL, the concept of include files is obsolete. They had their time back in the times of Progress V8-.

Nevertheless they are still widely used.

You can also name the parameters that you pass to an include file so that you are not bound to the order in which they need to be specified:

Code:
{ myInclude.i &initial="Not good ..." }
Code:
/* myInclude.i */
define {&shared} variable myVariable  as character initial "{&initial}".

Heavy Regards, RealHeavyDude.
 
Thank-you for your replies

New day ... New session ... New freshly restarted system ... Complete re-compile of all source:
NO ERRORS!!! Arrggg!!! The following; {include.i " " abc-} compiled and runs as designed ... so now I really have no idea why this failed to compile yesterday.

Will review the named params concept to see if it is supported in the current deployed version as that sounds like a better approach going forward ... even after almost 2 decades of working with 4GL it amazes me there are still things to learn :) ... living a sheltered life ... maintenance has a tendency to limit exploring new design ... rewrites are not the norm ... changes typically involve copying and or encapsulating mature logic ... don't fix/change it if it ain't broke ... includes are a huge part of this process

Again thanks for the replies.
 
Named include parameters are truly ancient for Progress. I would be shocked to find you running a version that doesn't support it.

It would also be helpful to look into the &IF DEFINED and other compile time conditional logic. Makes working with old include based code a lot easier imo.
 
Back
Top