sponsored links

Collapse

Announcement

Collapse
No announcement yet.

free format string concatenation

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

  • free format string concatenation

    Ok, this is probably going to sound like a stupid question... but here goes...

    I have an array defined as such...
    Code:
         D ROW             s             70a   DIM(4)
    These are the definitions for the fields being concatenated....
    Code:
         D ROT3            C                   '^%3'    
         D HZP             S              5A
         D VTP             S              5A     
         D FontSize        S              6a    
         D F9              C                   '^WB1'
    item is a 15a field in my DDS.


    Later on in my program I try to build this string by doing this....
    Code:
               row(1) = row(1) + ROT3 + HZP + VTP + fontsize + F9 + item;
    My results are nothing but an empty row(1). Just a 70a full of blanks. I looked in debug and all the fields have the proper values in it... what am I missing? I thought you could just plop in the + and I was done...
    Your future President
    Bryce

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

  • #2
    Re: free format string concatenation

    thats because your statement needs to be row(1) = %trim(row(1)) + ...

    swap out the field names for field size... and you see
    70 chars = 70 chars + 2 char +....

    basically you are setting row(1) = row(1)

    Comment


    • #3
      Re: free format string concatenation

      yea what he said

      Code:
      row(1) = %trim(row(1)) + ROT3 + HZP + VTP + fontsize + F9 + item;
      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

      Comment


      • #4
        Re: free format string concatenation

        I could probably just drop the %trim(row(1)) couldn't i?
        Your future President
        Bryce

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

        Comment


        • #5
          Re: free format string concatenation

          never mind... no i can't....
          Your future President
          Bryce

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

          Comment


          • #6
            Re: free format string concatenation

            thats why i love youngsters..........if you'd drop it youd be right back where ya started!
            you could make it varying.....

            let me play with that...

            jamie
            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

            Comment


            • #7
              Re: free format string concatenation

              wait, I could make an array of varying ?? Really?? Where would I put the keyword?


              at any rate, I got it working.
              Your future President
              Bryce

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

              Comment


              • #8
                Re: free format string concatenation

                Youll have to test Ive never done this b4.

                Code:
                d count           S              3  0                               
                d FontSize        S              6a                                 
                 // changed cause F9 confusing                                      
                d FX              C                   '^WB1'                        
                d HZP             S              5A                                 
                d item            S             10A   inz('cheese')                 
                d ROW             s             70a   DIM(4)  varying               
                d ROT3            C                   '^%3'                         
                d VTP             S              5A                                 
                d FXXX            C                   '^WB1'                        
                                                                                    
                 /Free                                                              
                       for  count = 1 to %elem(row);                                
                        row(count) = 'Element#:' + %char(count) +                   
                                     ROT3 + HZP + VTP + fontsize + FX + item;       
                       endfor;                                                      
                                                                                    
                       *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

                Comment


                • #9
                  Re: free format string concatenation

                  Works like a charm. I added the varying keyword and took out my %trim(row(i)) statements and *tada*.

                  Thanks Jamie. I thought about the varying thing but didn't realize you could use 2 keywords like that. Learning new stuff everyday
                  Your future President
                  Bryce

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

                  Comment

                  sponsored links

                  Collapse

                  Working...
                  X