× 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: Multi Dimensional Array
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 11 Aug 1999 14:58:02 -0500

Rajeev,

       Maybe I don't understand what you're trying to do, but I'm
completely missing what you're saying about the "trailing blank"
characters.  Where did they come from?

You seem to be viewing an array as a collection of records, and its
not... its (in this example) 6000 byte area of memory, thats divided
(only by our program logic) into 60-byte chunks by doing some simple
math.

You don't want/need delimiters because the "records" that you're
referring to are actually FIXED LENGTH.  Therefore, you know that
the first record ends in position 60 and the next starts in position
61.

In an array, each discrete unit is independent of the others.
In the example I showed you, each element of the array is alphanumeric
and is one character long.

You can't assign 'New Stringbbbbb' to it because thats MORE THAN ONE
character long.

If you're not looking for a two-dimensional array (an array that
has two dimensions instead of one) but are rather looking for a way
to load multiple records into memory, you'd be better off using a
multiple occurrance data structure!

Maybe if you explained a bit more about what you're doing, and why,
I'd be able to give you an answer that'd make more sense...

Scott Klement
Information Systems Manager
Klement's Sausage Co, Inc







>
> Hi Scott,
>
> Thanks a lot for your reply, I think I logic will work  but for
>  'simulating 2
> dim arrays'(the II one) logic, I see that this logic will do somethi
>  else.
>
>
> Clarification:
>
> How will compiler know to jump to next record? Each array record has
>  to be of 60
> chars only. So after 60*(X-1) + Y, it'll take trailing blanks too th
>  are there
> after 60 chars cause there are no delimiters. Right?
>
> e.g.
> <----------------60----------------------><------20------>
> <------------(35 ... 50)-----------------><------20------>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
> ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
> ...
> @
> KKKKKKKKKKKKK(10 th Rec)KKKKKKKKKKKKKKKKKK
> ...
> @
> Let's say I have to change 35th to 50th position in 10th record.
>
> As per above logic,
>
> X = 10
> Y = 16
> A = 'New Stringbbbbb'
>
> D Array           S              1A   DIM(6000)
>
> C                   eval      Array(((X-1)*60) + Y) = A
>
> (X-1)*60 + Y will be (10 - 1) * 60 + 16 = 556.
> So, starting 556th position, the string will be changed. And this wi
>  include
> 20 blanks after each record. So, instead of 10th record, the 6th
>  record will
> have a changed string starting position 76. This is not desired. And
>  this is
> because of no delimiter.
>
> Am I missing something?
>
> Thanks,
> Rajeev.
>
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END



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.