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



Hi Igor,

One way could be as shown below 


Module : MODDS1 

0000.01 DDs1              Ds                  Export              
0000.02 DNum                             4S 0 Inz(100)            
0000.03 DChar                           10    Inz('Hi')           
0000.04  *                                                        
0000.05 DMODDS2           Pr                                      
0004.00  *                                                        
0005.00 C                   CallP     MODDS2                      
0006.00 C*                                                        
0007.00  *                                                        
0008.00 C                   Eval      *Inlr = *On                 


Module : MODDS2   

0000.01 H Nomain                                             
0000.02  *                                                   
0002.00 DDs1              Ds                  Import         
0003.00 DNum                             4S 0                
0004.00 DChar                           10                   
0005.00  *                                                   
0006.00 DMODDS2           Pr                                 
0007.00  *                                                   
0008.00 PMODDS2           B                   Export         
0009.00 DMODDS2           Pi                                 
0009.01  *                                                   
0010.00 C     Ds1           Dsply                            
0011.00 C                      Return
               *               
0011.01 PMODDS2           E                                  

Please note that while calling MODDS2 from MODDS1, I am not passing any
parameters
When defined Export and Import on 'D' specs it is just as to pass parameters


Thanks
Sadiq .....  





 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Igor.Beslic@xxxxxxxxxxxx
Sent: Monday, March 13, 2006 3:44 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: IMPORT exported RPG data structure

I'm experimenting with EXPORTED DataStructures and I found I don't know how
to properly do that. MODUL A is eporting DS and modul B is importing. 
There are two versions of modul B. One is working as I expected and another
is working but obviosly DS structure is not resolved during bind time... I
need opinion about examples listed down:



MODUL_A (provides subProcedures for handling transactions AND an exported DS
that represents current transaction)
------------------------------------------------------------

/COPY PROTOS......
D transaction     DS
D  VALUEDATE                      D
D  POSTIDATE                      D
D  TEXTTRANSAKC                 30A
D  AMOUNT1                      15  0
D  AMOUNT2                      15  0
D transakcija     DS                  LIKEDS(transaction) EXPORT

// subrotines for handling transakcija DS (not important)

MODUL_B NON WORKING VERSION (cycles throught prepared transactions but
IMPORTED structure isn't resolved)
------------------------------------------------------------

/COPY PROTOS......
D transaction     DS
D  VALUEDATE                      D
D  POSTIDATE                      D
D  TEXTTRANSAKC                 30A
D  AMOUNT1                      15  0
D  AMOUNT2                      15  0
D trans           DS                  IMPORT('TRANSAKCIJA')
 /free
   prepareTransactions(subKey:d'2005-01-01':d'2005-12-31');
   DOW nextTransaction;
       // This line DISPLAYS only first CHAR of DS
          // If I reference trans.OPISTRANSAKC I'm getting COMPILE ERROR
       DSPLY trans;
   ENDDO;

   *inlr=*ON; 
   return;
  /end-free




MODUL_B WORKING VERSION (cycles throught prepared transactions and IMPORTED
structure subfields are OK)
------------------------------------------------------------

 /COPY PROTOS......

 D transaction     DS
 D  VALUEDATE                      D
 D  POSTIDATE                      D
 D  TEXTTRANSAKC                 30A
 D  AMOUNT1                      15  0
 D  AMOUNT2                      15  0
 D trans           DS                  IMPORT('TRANSAKCIJA')
 D trans2          DS                  LIKEDS(transaction)
 D                                     BASED(trans2ADR)

  /free
   trans2ADR=%ADDR(trans);
   prepareTransactions(subKey:d'2005-01-01':d'2005-12-31');
   DOW nextTransaction;
       DSPLY trans2.OPISTRANSAKC;
   ENDDO;

   *inlr=*ON; 
   return;
  /end-free

Do anybody have a simple working example of using IMPORTED datastructure. 
My working module is OK but I believe there is simplier way to achieve that
than using pointers.


Thanks!
dipl.ing. Igor Bešlić,
IBM Certified Specialist ILE RPG Programmer
VOLKSBANK d.d.
OJ Informatika
Varšavska 9, 10000 Zagreb
tel: +385 1 4801 895

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.