ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Trying to run SQL for report, and use report as message text in email

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

  • Trying to run SQL for report, and use report as message text in email

    This is a very simple report. Basically, if the SQL selects any records, there is a problem that someone needs to resolve, so the report is basically an error list and I want to email it to those responsible. I don't want people to need to open an attachment to see what is wrong. Its not going to be more than a page long. I just want to make sure they see what it contains. The big problem is that I can't see how to get the message text field loaded from the report file. Loading it from a print file might work, but I don't know a way to do that either.

    So my thought is:
    1. app creates file (already exists)

    2. sql is run that extracts error records
    --- I tried to use RUNSQL but since its a SELECT, it won't work. I was able to use QSH's db2 command

    3. if no records, all done, no email needed (I know how to do this)

    4. run sql report to file (needs field headings)
    --- If I use QSH db2 command the result is an IFS text file, but I can't see how to get that into a CL variable for message text. I thought I could bring it into a file, but the records don't want to come into one line each.

    5. load file into message variable

    6. send email

    Anyone got any easy ideas or code that would help?

  • #2
    I would look at MMAIL. Its free. It allows you to email out a ifs file (your report) as in inline message.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment

    Working...
    X