ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Help with Variable in middle of sentence

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

  • Help with Variable in middle of sentence

    Ok i have a paragraph in a prtf, each line is 100 characters long. after the" i want" will be a variable name which i am pulling from a field in a file. this name can be up to 60 characters long. so how can i tell if its too long for the line and go to the next line? Also i want to continue the sentence after the name without any space? Thanks

    A 12'This is an example of my prtf, please hel-
    A p me on how to do this. I want '


  • #2
    I would take the text in the printer file and put it in a varying length variable in your RPG program.
    Then build the entire text with the up to 60 character name.

    Now use the %SCANR() function to search for the character left from position 100 that is a blank.
    Substring from position 1 to blank_position into the 100 character line field in your printer file and write it.
    Remove the characters from 1 to blank_position from the variable length field.
    And repeat the process till the varying length field is empty.

    You might test if the position 101 is blank. Then you know that the first 100 characters in variable length field
    fits in the field in the printer file.

    Regards
    Peder

    Comment

    Working...
    X