Optional arguments in subroutine

226 views
Skip to first unread message

Marcin Kuśmirek

unread,
Jun 27, 2023, 11:15:58 AM6/27/23
to Pick and MultiValue Databases
I start programming with pick and multivalue databases and I have a question, can arguments in subroutine be optional??

Joe Goldthwaite

unread,
Jun 27, 2023, 11:33:42 AM6/27/23
to mvd...@googlegroups.com
No.  If you don't provide all the arguments in the subroutine the call will fail. Possibly some versions of MVDB allow it but I don't know of any.

------- Original Message -------

On Tuesday, June 27th, 2023 at 6:49 AM, Marcin Kuśmirek <marcin_...@interia.pl> wrote:

I start programming with pick and multivalue databases and I have a question, can arguments in subroutine be optional??

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/06a9e18d-c04d-4d29-9361-cd6700b8177fn%40googlegroups.com.

Marcin Kuśmirek

unread,
Jun 27, 2023, 1:52:45 PM6/27/23
to Pick and MultiValue Databases
Thank you, that's what I thought . I couldn't find information about it anywhere

Mike Preece

unread,
Jun 27, 2023, 2:01:19 PM6/27/23
to Pick and MultiValue Databases
You can pass an array as an argument. If you want arguments to be optional you can do that. Some attributes/multivalues can be an empty string which you can treat as missing/null - if that's what you want to do.

Brian Speirs

unread,
Jun 27, 2023, 3:43:32 PM6/27/23
to Pick and MultiValue Databases
As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments:

SUBROUTINE name{(arg1 {, arg2...}) {VAR.ARGS}}

Not only that, the arguments can be given default values in the subroutine declaration:

SUBROUTINE CREDIT.RATING(CLIENT, CLASS = 1, CODE = "Standard") VAR.ARGS

I haven't used the default values feature, but I do use the variable number of arguments feature.

Cheers,

Brian

Marcin Kuśmirek

unread,
Jun 28, 2023, 4:40:53 AM6/28/23
to Pick and MultiValue Databases
Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls .

Thanks

Mike Preece

unread,
Jun 28, 2023, 4:59:13 AM6/28/23
to Pick and MultiValue Databases
One technique to bear in mind, although it might not be applicable in your case, is to code subroutines to have two arrays as arguments. One is a list of variable names and the other a corresponding list of variable values. That allows for total flexibility.You might have to use LOWER and RAISE instructions to allow for sending items as attributes, attributes as values, values as subvalues, and use char(251)s to separate subvalues within the value argument.

Nivethan Thiyagarajah

unread,
Jun 28, 2023, 8:19:21 AM6/28/23
to mvd...@googlegroups.com

If most of the routines are going to be fine not passing in the value you can instead write another version of the subroutine that takes 2 parameters and make this the real subroutine. Then in the version with a single parameter, change it to a single line routine that calls the 2 param version with the 2nd param defaulted.

 

Now you can choose to use the single param or 2 param version but the single param version is really just calling the 2nd param version. This way you have the logic in just one place.

 

 

 

From: mvd...@googlegroups.com <mvd...@googlegroups.com> On Behalf Of Marcin Kusmirek
Sent: Wednesday, June 28, 2023 2:49 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: Re: [mvdbms] Optional arguments in subroutine

 

Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls . Thanks wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a): As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments: SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }} Not only that, the arguments can be given default values in the

 

External Sender

This email was sent from outside your organization.

Reply only if you know this sender and trust the content.


Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls .

 

Thanks

wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a):

As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments:

 

SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }}

Nivethan Thiyagarajah

unread,
Jun 28, 2023, 8:19:21 AM6/28/23
to mvd...@googlegroups.com

Specifically for UniVerse, I implemented hashmaps that will let you do something similar except you use a single dimensioned array and then you can pass as many key value pairs as you like and they can be anything themselves. It removes the need to juggle the raise and lowers.

 

You can see it in action under the Hashmap Subroutines.

 

https://github.com/Krowemoh/TCL-Utilities

 

 

 

From: mvd...@googlegroups.com <mvd...@googlegroups.com> On Behalf Of Mike Preece
Sent: Wednesday, June 28, 2023 4:59 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: Re: [mvdbms] Optional arguments in subroutine

 

One technique to bear in mind, although it might not be applicable in your case, is to code subroutines to have two arrays as arguments. One is a list of variable names and the other a corresponding list of variable values. That allows for total flexibility.You might have to use LOWER and RAISE instructions to allow for sending items as attributes, attributes as values, values as subvalues, and use char(251)s to separate subvalues within the value argument. On Wednesday, June 28, 2023 at 9:40:53

 

External Sender

This email was sent from outside your organization.

Reply only if you know this sender and trust the content.

One technique to bear in mind, although it might not be applicable in your case, is to code subroutines to have two arrays as arguments. One is a list of variable names and the other a corresponding list of variable values. That allows for total flexibility.You might have to use LOWER and RAISE instructions to allow for sending items as attributes, attributes as values, values as subvalues, and use char(251)s to separate subvalues within the value argument.

On Wednesday, June 28, 2023 at 9:40:53 AM UTC+1 marcin_...@interia.pl wrote:

Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls .

 

Thanks

wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a):

As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments:

 

SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }}

Message has been deleted

John Stokka

unread,
Nov 28, 2023, 7:54:37 AM11/28/23
to mvd...@googlegroups.com
Well this is annoying.  Has someone banned him yet? ;)

On Tue, Nov 28, 2023 at 1:27 AM Dane christian Neilson <danechri...@gmail.com> wrote:

DIRECT SENDER IS HERE LETS DEAL.

Dane Christian Neilson




MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
SLBC PROVIDER
CREDIT CARD TOP UP
SEPA TRANSFER
WIRE TRANSFER
GLOBALPAY INC US

Thanks.


NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.

DM ME ON WHATSAPP FOR A SERIOUS DEAL.

+14234753476
Reply all
Reply to author
Forward
Message has been deleted
0 new messages