×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




What we had to do in this case (we needed to do the whole thing in RPG -
don't ask) was to use the QWCRDTAA API to read the data area. To write back
to it, we just built a string to QCMDEXC. The documentation for the QWCRDTAA
API is at:

http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qwcrdt
aa.htm

Here's an example for changing the data area  (the variable factor here was
the library, not the data area name, we have eight databases). The variable
Dtaara is a 16-byte data structure with the data area's new value):
    
         // Named Constants                              
     D Quote           C                   Const('''')

         // Prototype for 'QCMDEXC'                                  
     D Qcmdexc         PR                  Extpgm('QCMDEXC')      
     D Comand_                     3000A   Const Options(*VARSIZE)
     D Length_                       15P 5 Const                  
     D Dbcs_                          3A   Const Options(*NOPASS) 

      /free
      // Update draft data area with submitted flag.                  
      Comand = 'CHGDTAARA DTAARA(' + %TRIM(Lib) + '/DRAFTDTA) VALUE(' 
      + Quote + Dtaara + Quote + ')';                                 
      Qcmdexc (Comand : %LEN(%TRIMR(Comand)));                  
      /end-free

And here is how we use the QWCRDTAA API (please note that our DRAFTDTA data
area is 16 bytes long - the value of it will be in Dtav1 - you will have to
adjust the sizes of  Dtarec and Dtav1 accordingly):

         // Data area API call parameters                       
                                                             
         // Receiver variable                                   
     D                 DS                                    
     D Dtarec                        52A                     
     D  Dtab1                        10I 0 Overlay(Dtarec)   
     D  Dtab2                        10I 0 Overlay(Dtarec:5) 
     D  Dtac1                        10A   Overlay(Dtarec:9) 
     D  Dtac2                        10A   Overlay(Dtarec:19)
     D  Dtab3                        10I 0 Overlay(Dtarec:29)
     D  Dtab4                        10I 0 Overlay(Dtarec:33)
     D  Dtav1                        16A   Overlay(Dtarec:37)
                                                             
         // Length of receiver variable                         
     D Dtalor          S             10I 0 Inz(%LEN(Dtarec))  

         // Qualified data area name                             
     D                 DS                                     
     D Dtaqal                        20A                      
     D  Dtanam                       10A   Overlay(Dtaqal)    
     D  Dtalib                       10A   Overlay(Dtaqal:11) 
                                                              
         // Starting position                                    
     D Dtasp           S             10I 0 Inz(1)             
                                                              
         // Length of data                                       
     D Dtalod          S             10I 0 Inz(%LEN(Dtaara))  
                                                              
         // API error data structure                             
     D                 DS                                     
     D Dtaerr                        52A                      
     D  Dtab5                        10I 0 Overlay(Dtaerr)    
     D  Dtab6                        10I 0 Overlay(Dtaerr:5)  
     D  Dtac3                         7A   Overlay(Dtaerr:9)  
     D  Dtac4                         1A   Overlay(Dtaerr:16) 
     D  Dtav2                        30A   Overlay(Dtaerr:17) 

         // Prototype for 'QWCRDTAA'                            
     D Qwcrdtaa        PR                  Extpgm('QWCRDTAA')
     D Dtarec_                             Like(Dtarec)      
     D Dtalor_                             Like(Dtalor)      
     D Dtaqal_                             Like(Dtaqal)      
     D Dtasp_                              Like(Dtasp)       
     D Dtalod_                             Like(Dtalod)      
     D Dtaerr_                             Like(Dtaerr)      

And here is the subroutine that gets the data area value:

          //////////////////////////////////////////////////////////////////

          // GETDTA - Get data area information                           //

          //////////////////////////////////////////////////////////////////

      /free

       Begsr Getdta;                                                      
 

       Dtanam = 'DRAFTDTA';                                               
       Dtalib = Lib;                                                      
       Clear Dtarec;                                                      
       Clear Dtaerr;                                                      
 

       Qwcrdtaa ( Dtarec : Dtalor : Dtaqal : Dtasp : Dtalod : Dtaerr );   
 

       Dtaara = Dtav1;                                                    
 

       Endsr;                                                             
      /end-free

Francis Lapeyre
IS Dept. Programmer/Analyst
Stewart Enterprises, Inc.
E-mail: flapeyre@xxxxxxxx 


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