Data structure array in RPG

1465 pts.
Tags:
AS/400
RPG
I have a physical file has 10 column like filed01, filed02, field03......field10 Now I want to define a data structure with 10 subfield of char 5 and use in cursor. For example:
select * from t1
fetch from t1 into :DS1
Now I want a array of 10 element automatically get the value from my DS1. Thanks in advance!
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

create your data structure like this:

d DS2             ds                                          
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d                                5a                           
d  Arr1                          5a     dim(10) overlay(DS2:1)

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    What code do you have so far, and what problem are you having with it?
    33,670 pointsBadges:
    report
  • 9783444184
    Hi Raven,
    I want how to use data structure array 
    DDS2                   DS                                        Inz      
    D Arr1                          50A   Dim(10)  
     /free
    Declare A Cursor For                       
    Select                                     
           ILTR01,ILTR02,ILTR03,ILTR04,ILTR05, 
           ILTR06,ILTR07,ILTR08,ILTR09,ILTR10  
    from File;
    Exec Sql Open A;                  
    Exec Sql Fetch From A Into :DS2;   
     /End-free 
    1,465 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: