IF statement in AS/400 query

5 pts.
Tags:
AS/400 Query
IF statement
Can I use an if-type statement to return a different value? For example, i thought i would use define results fields to say if(lnt03=34,"advance","payoff") liek I would in excel. of course this doesn't work...

Answer Wiki

Thanks. We'll let you know when a new response is added.

No, their are a number of third party products but Query/400 doesn’t do conditionals

Impossible no, not at all!!
Create three queries
— query #1 selects only records with lnt03=34 and has a result field TXTFLD value ‘advance’
it sends output to a tempfile
— query #2 selects only records with Int03 <> 34 and has a result field TXTFLD value ‘payoff’
it <ul>adds</ul> records to the file
— query #3 creates a report from the file.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Biggest Halloween » Blog Archive » IF statement in AS/400 query
    [...] unknown wrote an interesting post today onIF statement in AS/400 queryHere’s a quick excerptNew Question Created. by KPSTL. [...]
    0 pointsBadges:
    report
  • Gilly400
    Hi, If you're doing this in SQL you can use CASE. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • trdiaz
    You will be glad if you put the effort into learning to use Case expressions in SQL--that's SQL's way of doing if-then-else constructions.  Then you will  have a single query that does it all.
    10 pointsBadges:
    report
  • ToddN2000
    I know this is an old post, but that query has been outdated for years. Try using WRKQMQRY if it must be done this way. The best method will be using SQL to create a table with the results then load that to Excel for printing.
    59,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: