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


  • Subject: Re: $Center procedure (was Procedure Problem)
  • From: bmorris@xxxxxxxxxx
  • Date: Wed, 5 Jan 2000 09:23:29 -0500




>Date: Tue, 4 Jan 2000 21:45:22 -0500
>From: "Wayne Achenbaum" <wache@slomins.com>
>
>Thanks again Barbara. I appreciate the further input and it sounds like it
>will work just fine, and I learned how to define the length of a variable
>size field. But I don't see where the procedure call will fail to return a
>centered field when using  eval ctrfld = $center(entfld). As long as
entfld
>is within 256 bytes.

If the input is 'ab    ', the centered result is '  ab  '.  If you return
a fixed-256 byte field with this value, you actually return '  ab        '.
The procedure only works if the receiver is the same length as the input.
If the receiver is fixed length, it doesn't matter if the returned value is
varying or fixed, but if the receiver is varying length, the receiver has
the ability to receive the true centered value of '  ab  ' if you return it
that way.

In case my point still isn't clear, let's assume you are returning 10
bytes.
If fld is fixed length 10, and fldv is varying length 10, then if you do
   C       eval    fld = $center('ab  ')
   C       eval    fldv = $center('ab  ')
fld and fldv will both have the value ' ab       '; fldv will have a length
of 10.  If you return a varying length value, and do the same assignments,
fld will still have the value ' ab       ' but fldv will have the centered
value ' ab ' and a length of 4.  Returning a fixed length field would also
make your function inconvenient to call as part of an expression.
   C       eval    msg = 'The centered value is <' + $center(name) + '>'
   'The centered name is <  Bing  >.'
vs 'The centered name is <  Bing                                >.'

I'm belabouring this point because this is a very common type of procedure
-
one that takes a string value and returns another string value whose length
varies according to the input value.  If the parameter is varying length,
so should the result be varying length - not just by definition, but by
nature as well.

Barbara Morris


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.