IF loop

335 pts.
Tags:
AS/400
RPGLE
key1 chain file1 if %found(file1) elseif key1 chain file2 Can anyone let me know whether the above if loop is correct or not?

Software/Hardware used:
iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    key1  chain   file1
    if %found(file1)
    ...
    elseif
    key1   chain file2
    It's hard to say since there is no "loop" shown. And the logic is so incomplete that it's not possible to figure out what you intend. There are no ENDIFs, so it's not clear what should execute.   You need to explain more.   Tom
    125,585 pointsBadges:
    report
  • JSDHFKJHA
    tom i want to let u know that if i keep an if loop in that manner will it execute or not ofcouse i will include endif in the last thats not an issue but i want to know that after the 'elseif' can i keep the chain stmt like that?please do me the needfull help 
    335 pointsBadges:
    report
  • TomLiotta
    Well, it's not a loop at all; but there's no reason you can't have a second CHAIN down in a nested IF-statement. The ElseIf is missing a condition, though, in your example. You could use a simple Else instead of ElseIf if you aren't going to need a condition. (Just don't call it a "loop".) -- Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    "Loops" are with the opcode DO, DOW, DOU.... IF's are for nesting conditions. If you are asking if you IF / ELSEIF will work, you need a second condition like Tom mentioned. Otherwise just use an ELSE and put the IF condition on it's own line as you did in your first chain and %found test.
    8,500 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following