ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

QMQRY trimming trailing blanks of variable

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

  • QMQRY trimming trailing blanks of variable

    I am facing an issue in Setvariable in QMQRY. My variable has trailing blanks, but while executing the query, those trailing blanks get suppressed. I dont want that to happen.

    STRQMQRY QMQRY(mylib/query1) OUTPUT(*OUTFILE) OUTFILE(Qtemp/t1) setvar(STRING1 &str1) (STRING2 &Str2)

    In this case
    &STR1 = ‘SELECT FIELD05 from mylib/myfile where field01 '
    &STR2 = ‘Like ”%efg%” ‘

    I face issue with &STR1 where STRQMQRY trim the trailing blanks(one blank after the field01 at the end) when running the actual query and so it results in error.


    Query1 has value &STRING1&STRING2

  • #2
    Does it also trim off leading Blanks? Try adding a leading Blank in front of like.

    Comment

    Working...
    X