Question Non mandatory parameters

Hello guyz,

As I try with my team to standardize our code base, we would like to have a procedure that can have mandatory parameters and non mandatory parameters.
I can't find a way to do it.
Is it possible?

Best Regards
 

Stefan

Well-Known Member
Have you looked at using classes? Overloaded methods can help.

Code:
class foo:

   method void bar (
      i_cone as char
   ):

      bar( i_cone, ? ).

   end method.

   method void bar (
      i_cone as char,
      i_ctwo as char
   ):

      message i_cone i_ctwo.
   
   end method.

end class.
 
Thank you @Stefan.

I wasn't going to go this way, because right know I'm already the only one who is able to understand and do persistent procedure on a session level. And I'm trying to teach my colleges on it.
But if the only solution is using class, I will do it :)

Best Regards,
 

Stefan

Well-Known Member
If you make your inputs variant (for example a temp-table with key value pairs) you can also achieve optional parameters, but I think this can be overkill.
 

missguided79

New Member
This reminds me of, Garbage IN garbage OUT .
Y use a work around - just pass a parameter ANYWAY.
THEN validate THAT parameter WITH a basic check usin UR requirements.
IF the parameter BEGINS "pants" THEN RETURN NO-ERROR, /* drop out */ - U CAN implement a system format here 4 this
ELSE
DO:
/* what U WANT 2 happen */
END.
 
Last edited:
Top