ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

kinda nerdy cool also eval-corr

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

  • kinda nerdy cool also eval-corr

    IBM Says


    PHP Code:

          
    //
          //  data structures
          //

         
    d cheesepizza     ds                  qualified  inz
         d  wheat                        10
         d  yeast                        15
         d  basil                        20
         d  cheese                        2  0

         d meatpizza       ds                  qualified  inz
         d  wheat                        10
         d  yeast                        15
         d  basil                        20
         d  cheese                       25
         d  meat                         30

          
    /Free

            
    //--------------------------------------------------------
            // MAIN PROGRAM
            //--------------------------------------------------------

               // notice the two data structures cheese is defined as 2,0 
               // in cheesepizza but its 25 *char in meatpizza... 
               // Also meat pizza has MEAT.
               // how can I move the data from cheesepizza to 
               // meatpizza easily????
               // V5R4 has the  eval-corr opcode .
               // The EVAL-CORR operation assigns data and null-indicators 
               // from the corresponding
               // subfields of the source data structure to the subfields 
               // of the target data structure.


                 
    cheesepizza.wheat  'wheat';
                 
    cheesepizza.yeast  'yeast';
                 
    cheesepizza.basil  'basil';
                 
    cheesepizza.cheese 11;

                 eval-
    corr meatpizza cheesepizza;


               
    // _________________________________
               //
               //     D E B U G    S A Y S
               // _________________________________

                  //   EVAL meatpizza
                  //   MEATPIZZA.WHEAT = 'wheat     '
                  //   MEATPIZZA.YEAST = 'yeast          '
                  //   MEATPIZZA.BASIL = 'basil               '
                  //   MEATPIZZA.CHEESE = '                         '
                  //   MEATPIZZA.MEAT = '                              '


                 
    *inlr = *on;

          /
    End-Free 
    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

  • #2
    Re: kinda nerdy cool also eval-corr

    So it doesn't carry numeric values into a string. That's ok. I don't code in /free anyway

    Definitely way cool though
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: kinda nerdy cool also eval-corr

      eval-corr moves like fields...so basically for the data to pass the field name, data type & size must match.
      I'm not anti-social, I just don't like people -Tommy Holden

      Comment


      • #4
        Re: kinda nerdy cool also eval-corr

        Acts kinda like method overloading cool


        *sorry, been programming in java, i'm on a OOP kick
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment

        Working...
        X