Results 1 to 18 of 18

Thread: clear data structure array

  1. #1
    Code400 Newbie
    Join Date
    Jan 2006
    Location
    Indonesia
    Posts
    34
    Rep Power
    675

    clear data structure array

    Hi guys,

    i have a problem with the data structure.
    is there anyway to clear the data structure array without
    looping the program with ocur???
    just one step just usual array.


    Code:
    I  DSDT        DS                         99              
    I                                            1  22 #DT1  
    I                                            1  110#DSACC
    I                                           12  13 #DSKDW
    I                                           14  220#DSNOW
    
    it just a simple coding like this :
    
    C   2         OCUR    DSDT           
    C              MOVEL  'TEST'    DSDT 
    C   1         OCUR    DSDT           
    C              CLEAR   DSDT           
    C   2         OCUR    DSDT           
    
    when i clear the DSDT, it only clear the data structure in occurence 1,
    is there anyway to clear all the DS without looping like this :
    
    C           Z-ADD1  $X      4 0
    C     $X  DOWLE  99
    C     $X  OCUR     DSDT
    C           CLEAR    DSDT
    C           ADD       1       $X
    C           ENDDO
    ???? any simple way like clear array? or function that i don't know maybe?

    Thx u

  2. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

  3. #2
    Analyst
    Join Date
    Jan 2006
    Location
    Little Rock, AR
    Posts
    38
    Rep Power
    680

    Re: clear data structure array

    clear DTST
    Jim Waymire

  4. #3
    Analyst JonBoy's Avatar
    Join Date
    Jun 2005
    Location
    Mississauga, Ontario, Canada
    Posts
    392
    Rep Power
    1893

    Re: clear data structure array

    Well the first point to note is that you _don't_ have a DS array in your code - you have a multiple occurence DS (MODS) which is not the same thing. When you use a MODS - as you have noticed - you can only access (and therefore clear) one element at a time _unless_ you specify *All as Factor2 - in this case all elements are cleared.

    MODS are effectively deprecated with the advent of DS arrays in V5R2. Simply define DIM(...) on the DS definition line to define one. With these a CLEAR will always work on all elements.

  5. #4
    Code400 Newbie
    Join Date
    Jan 2006
    Location
    Indonesia
    Posts
    34
    Rep Power
    675

    Re: clear data structure array

    so cannot clear all the Data Structure at once?
    if can, would u give me the example...
    right now i just using the RPG III, i'd like to use the rpg iv, but
    cannot do that, because of the project use the rpg iii.

    Thanks

  6. #5
    Analyst giri's Avatar
    Join Date
    May 2005
    Location
    Salt lake City, US
    Age
    33
    Posts
    247
    Rep Power
    1663

    Re: clear data structure array

    the code u need to use is

    C CLEAR *ALL DSDT
    Thanks,
    Giri

  7. #6
    Code400 Newbie
    Join Date
    Jan 2006
    Location
    Indonesia
    Posts
    34
    Rep Power
    675

    Re: clear data structure array

    oohh i think i get it, it seems the syntax only works in RPG IV. But now
    I am working on RPG III.
    BTW Thx guys

  8. #7
    Analyst JonBoy's Avatar
    Join Date
    Jun 2005
    Location
    Mississauga, Ontario, Canada
    Posts
    392
    Rep Power
    1893

    Angry Re: clear data structure array

    Sob!

    Why oh why is anyone still using RPG III !!

    The bl**dy thing has been obsolete for over 12 years! Isn't IBM saying that the S/36 and S/38 compilers are becoming a PRPQ after V5R4 enough writing on the wall to warn people to stop wasting their money!!!

    Snarl snarl snarl (can't see an icon for that!)


    Jon P

  9. #8
    Sr. Product Specialist FaStOnE's Avatar
    Join Date
    Nov 2005
    Location
    Phoenix, AZ
    Age
    51
    Posts
    2,611
    Rep Power
    3991

    Re: clear data structure array

    Count your blessings where they lie... at least it wasn't RPGII, using IDDU and OCL!

    -Rick

    _____________________________

    Need a Managed File Transfer Solution -OR- iSeries Encryption?
    GoAnywhere and Crypto Complete by Linoma Software


  10. #9
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: clear data structure array

    did someone say snarl?
    Attached Images Attached Images  
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  11. #10
    Ex - Solutions Architect kpmac's Avatar
    Join Date
    Aug 2005
    Location
    NJ
    Age
    36
    Posts
    454
    Rep Power
    2431

    Re: clear data structure array

    Ewwww..... How bout RPGIII with member types of RPT? You never knew what copy book was for what part of the source.

    Grandpa, can you make the dinosaur run across the screen again???

    Ha ha ha ha ha ha ha!
    Last edited by kpmac; February 22nd, 2006 at 02:11 PM.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

  12. #11
    Sr. Product Specialist FaStOnE's Avatar
    Join Date
    Nov 2005
    Location
    Phoenix, AZ
    Age
    51
    Posts
    2,611
    Rep Power
    3991

    Re: clear data structure array

    And ... don't forget .. that was also on the old ONE LINE SEU Editor!

    Top 'o the line guys ... couldn't beat it with a drum stick!
    -Rick

    _____________________________

    Need a Managed File Transfer Solution -OR- iSeries Encryption?
    GoAnywhere and Crypto Complete by Linoma Software


  13. #12
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: clear data structure array

    okay tuff guys here it is with a straight CVTRPGSRC show me whatcha got

    Code:
         d DSDT            DS                  OCCURS(99)
         d  CLK                    1    100
         d  #DT1                   1     22
         d  #DSACC                 1     11  0
         d  #DSKDW                12     13
         d  #DSNOW                14     22  0
          *
         c     *LIKE         DEFINE    MODE          SFLLOC
          *
         c     1             OCCUR     DSDT
         c                   MOVEL     'TEST'        DSDT
         c     2             OCCUR     DSDT
         c                   CLEAR                   DSDT
         c     3             OCCUR     DSDT
         c                   CLEAR                   DSDT
          *
         C                   MOVE      *ON           *INLR
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  14. #13
    Ex - Solutions Architect kpmac's Avatar
    Join Date
    Aug 2005
    Location
    NJ
    Age
    36
    Posts
    454
    Rep Power
    2431

    Re: clear data structure array

    Code:
     *-------------------------------------------------------------------*        
     *                          Data Structs                             *        
     *-------------------------------------------------------------------*        
     *                                                                            
     *                                                                            
    D dsDT            DS                  OCCURS(99) Inz                          
    D  CLK                         100A                                           
    D  #DT                          22A   OverLay(CLK:1)                          
    D  #DSACC                       11  0 OverLay(CLK:1)                          
    D  #DSKDW                        2A   OverLay(CLK:12)                         
    D  #DSNOW                        9  0 OverLay(CLK:14)                         
     *                                                                            
     *-------------------------------------------------------------------*        
     *                           Constants                               *        
     *-------------------------------------------------------------------*        
     *                                                                            
     *-------------------------------------------------------------------*        
     *                          Stand Alone                              *        
     *-------------------------------------------------------------------*        
     *                                                                       
    D idx             S              5I 0                                    
     *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*   
     *                             Main                                  *   
     *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=*   
     *                                                                       
     /free                                                                   
                                                                             
                                                                             
        For idx = 1 to %Elem(dsDT);                                          
          %Occur(dsDT) = idx;                                          
          dsDT = 'Test';                                               
        EndFor;                                                        
                                                                       
        Reset dsDT;                                                    
                                                                       
        Clear *All dsDT;                                               
                                                                       
        For idx = 1 to %Elem(dsDT);                                    
          %Occur(dsDT) = idx;                                          
          dsDT = *Blanks;                                              
        EndFor;                                                        
                                                                       
        *InLr = *On;                                                   
                                                                       
     /end-free
    Note: Clear *All and Reset will the numeric fields in the MOD to *Zeros and the For loop will set the values to *Blanks.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

  15. #14
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: clear data structure array

    Nice - you dont get paid by the dash....do you?
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  16. #15
    Ex - Solutions Architect kpmac's Avatar
    Join Date
    Aug 2005
    Location
    NJ
    Age
    36
    Posts
    454
    Rep Power
    2431

    Re: clear data structure array

    Ha ha ha ha ha ha!!!! No, I have a slight problem called OCD.


    Hey, everybody needs standards. I find that its easier to page around the code this way. I keep everything pretty much the same and its easy to get to my structs, Stand alones, Constants. . .
    Last edited by kpmac; February 22nd, 2006 at 02:55 PM.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

  17. #16
    Driver of cars, eater of food jamief's Avatar
    Join Date
    Jan 2004
    Location
    Belvidere, IL - United States of America
    Age
    49
    Posts
    9,416
    Rep Power
    12605

    Re: clear data structure array

    While I was looking at the code I kinda felt like i was in prison----Again !!!

    This looks like barbed wire Which was invented here in Illinois by the way!

    *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +=+=+=+=+=+=+=+=+=*
    Click here
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  18. #17
    Sr. Product Specialist FaStOnE's Avatar
    Join Date
    Nov 2005
    Location
    Phoenix, AZ
    Age
    51
    Posts
    2,611
    Rep Power
    3991

    Re: clear data structure array

    Bite your lip Rick .. BITE YOUR LIP!!

    *humph*

    -Rick

    _____________________________

    Need a Managed File Transfer Solution -OR- iSeries Encryption?
    GoAnywhere and Crypto Complete by Linoma Software


  19. #18
    Code400 Newbie
    Join Date
    Jan 2006
    Location
    Indonesia
    Posts
    34
    Rep Power
    675

    Talking Re: clear data structure array

    Hahaha.. shame on me,

    I was using the RPG IV with ILE concept in my old companies and with free text too but now I am using the RPG III. phew maybe i am dreaming now

  20. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. Decryption API's in ILE
    By cndb41a in forum RPG/RPGLE
    Replies: 10
    Last Post: February 6th, 2006, 05:19 PM
  2. Replies: 8
    Last Post: June 17th, 2005, 02:44 PM
  3. rpgle
    By mohans in forum RPG/RPGLE
    Replies: 4
    Last Post: May 21st, 2005, 11:50 PM
  4. Data Structure and Array
    By colourwolf82 in forum RPG/RPGLE
    Replies: 2
    Last Post: October 26th, 2004, 03:47 AM
  5. Data Structure Array
    By Revathi Muruges in forum RPG/RPGLE
    Replies: 6
    Last Post: August 26th, 2004, 12:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •