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



Sounds doable.

Two items of concern here.
1)  Your 10 count do loop is going to run into a truncation error on the 
10th element.  (1 character field).  Unlike previous versions of RPG I 
wouldn't assume 0.
2)  Your first data structure subfield should not have a *next in it.

You've got your code this far now.  Why not test it?

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





MWalter@xxxxxxxxxxxxxxx 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/04/2004 11:57 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Re: Looking Up a Data Structure Array







No,

More like this:

 ddsArray          DS             1    dim(10) qualified
 D dsChar                         1    overlay(dsArray:*next)
 DdsIdx1           s             10u 0
 DdsIdx2           s             10u 0

 D/copy *libl/qrpglesrc,cvtdatepr
  /free

    for dsIdx1 = 1 to 10;
      dsArray(dsIdx1).dsChar = %char(dsIdx1);
    endfor;

    dsIdx1 = 1;
    dsIdx2 = %lookup('4':dsArray.dsChar:1);
    dsply dsIdx2;
    return;

I'd like to find a matching entry in a DS Array subfield.

Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


  
                      rob@xxxxxxxxx   
                      Sent by:                  To:       RPG programming 
on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> 
                      rpg400-l-bounces@m        cc:    
                      idrange.com               Subject:  Re: Looking Up a 
Data Structure Array 
  
  
                      10/04/2004 12:21   
                      PM   
                      Please respond to   
                      RPG programming on   
                      the AS400 /   
                      iSeries   
  
  




You mean like this:
     D                 ds
     D MyArray                        4a   dim(20)
     D  Code1                         2a   overlay(MyArray)
     D  Code2                         2a   overlay(MyArray:*next)
     D CurrNbrElem     s              5i 0
     D Result          s              5i 0
      /free
       Code1(1)='AA';
       Code1(2)='BB';
       Code1(3)='CC';
       Code2(1)='ZZ';
       Code2(2)='YY';
       Code2(3)='XX';
       // At this time MyArray(1)='AAZZ', (2)='BBYY', (3)='CCXX'
       CurrNbrElem=3;
       result = %lookup('YY':Code2:1:CurrNbrElem);
       dsply result;  // was equal to 2
       *inlr=*on;
       return;
      /End-free


Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





MWalter@xxxxxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/04/2004 08:54 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Looking Up a Data Structure Array







Is it possible to look up a data structure array subfield?

Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.






--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.