ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

movea in /free

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • movea in /free

    now back to the 21st century.
    How might I express this MOVEA in /free?

    PHP Code:
    d DescriptionARR  S             60    DIM(2)   

    d Description     DS                            
    d   DESC_E_1                    60              
    d   DESC_E_2                    60              
    d   DESC_All              1    120       

    c                   MOVEA     DescriptionARR DESC_All 

  • #2
    Re: movea in /free

    There is no direct replacement for MOVEA in Free-Format.
    The easiest way is to definie your array as data structure subfield.

    PHP Code:
    d NewDS           DS                             
    d DescriptionARR                60    DIM
    (2)    

    d Description     DS 
    d   DESC_All                                                  
    d   DESC_E_1                    60     Overlay
    (DESC_All)          
    d   DESC_E_2                    60     Overlay(DESC_All: *Next)          

     /
    Free
         Description 
    NewDS;
     /
    End-Free 
    Birgitta

    Comment


    • #3
      Re: movea in /free

      Originally posted by B.Hauser
      There is no direct replacement for MOVEA in Free-Format.
      The easiest way is to definie your array as data structure subfield.

      PHP Code:
      d NewDS           DS                             
      d DescriptionARR                60    DIM
      (2)    

      d Description     DS 
      d   DESC_All                                                  
      d   DESC_E_1                    60     Overlay
      (DESC_All)          
      d   DESC_E_2                    60     Overlay(DESC_All: *Next)          

       /
      Free
           Description 
      NewDS;
       /
      End-Free 
      Birgitta
      Birgitta's solution is an exact translation of the original RPG III mode code. But do you actually _want_ both copies of the data? if not you can simply modify the solution like so and avoid the Eval:

      Code:
      d Description     DS 
      d   DESC_All                                                  
      d   DESC_E_1                    60     Overlay(DESC_All)          
      d   DESC_E_2                    60     Overlay(DESC_All: *Next)          
      d  DescriptionARR               60     Overlay(DESC_All) DIM(2)

      Comment


      • #4
        Re: movea in /free

        Look into %subarr

        It can do most of the movea stuff.

        Comment


        • #5
          Re: movea in /free

          Originally posted by arrow483
          Look into %subarr

          It can do most of the movea stuff.
          Yes - but it can only do the real array moves - not the various perversities that MOVEA was co-opted for

          Comment

          Working...
          X