IBMiAccess




Results 1 to 9 of 9

Thread: free format string concatenation

  1. #1
    Programmer/Analyst I bryce4president's Avatar
    Join Date
    Apr 2007
    Location
    Lewisburg, PA
    Age
    31
    Posts
    2,895
    Rep Power
    4657

    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. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

  3. #2
    Analyst soup_dog's Avatar
    Join Date
    Aug 2006
    Location
    Richmond, VA
    Posts
    566
    Rep Power
    1849

    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)

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

    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

  5. #4
    Programmer/Analyst I bryce4president's Avatar
    Join Date
    Apr 2007
    Location
    Lewisburg, PA
    Age
    31
    Posts
    2,895
    Rep Power
    4657

    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

  6. #5
    Programmer/Analyst I bryce4president's Avatar
    Join Date
    Apr 2007
    Location
    Lewisburg, PA
    Age
    31
    Posts
    2,895
    Rep Power
    4657

    Re: free format string concatenation

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

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

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

    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

  8. #7
    Programmer/Analyst I bryce4president's Avatar
    Join Date
    Apr 2007
    Location
    Lewisburg, PA
    Age
    31
    Posts
    2,895
    Rep Power
    4657

    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

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

    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

  10. #9
    Programmer/Analyst I bryce4president's Avatar
    Join Date
    Apr 2007
    Location
    Lewisburg, PA
    Age
    31
    Posts
    2,895
    Rep Power
    4657

    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

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

Facebook Comments


Similar Threads

  1. Date calculation for RPGLE in Free format
    By Mikjall in forum RPG/RPGLE
    Replies: 5
    Last Post: October 29th, 2007, 11:26 AM
  2. Free Format Question
    By dcutaia in forum /Free format
    Replies: 9
    Last Post: January 17th, 2007, 09:26 AM
  3. Free Format RPG - Call program
    By dcutaia in forum /Free format
    Replies: 8
    Last Post: November 13th, 2006, 11:34 PM
  4. Move Char to numeric in free format RPG
    By ReachKrishna in forum /Free format
    Replies: 2
    Last Post: April 6th, 2006, 07:25 AM
  5. %check sqlrpgle
    By christinaf in forum RPG/RPGLE
    Replies: 1
    Last Post: January 19th, 2006, 03:56 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
  •