LEAVESR opcode for RPG

1505 pts.
Tags:
RPG
RPG Code
Is there anyway to perform LEAVESR operation in OLD RPG code. Unfortunately I have to amend some old written code. I am searching for related operation as LEAVESR. I have used GOTO (with tag). Is it ok?

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: 5  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
  • BigKat
    syntactically: yes, a GOTO with a tag will give you the equivalent of a LEAVESR.

    philosophically: no, "properly structured code" should not have to use GOTOs, ITERs, LEAVEs, and LEAVESRs.  The IF and DO logic should handle what needs to run and what doesn't. 

    practically: in some cases, the logic gets so complicated when not using ITERs, LEAVEs, etc. that it will be a maintenance nightmare for some future developer so sometimes you just have to do what you just have to do. 
    8,200 pointsBadges:
    report
  • Splat
    Any reason not to use the CVTRPGSRC on the source & bring the program a bit farther along?
    7,235 pointsBadges:
    report
  • hunshabbir7
    Actually I am new to RPG programming, I have seen somewhere that after converting code there might arise data type mismatch errors and some others, I don't want to get them up right now. Let them asleep, when I will have some time then I will try it. 
    1,505 pointsBadges:
    report
  • Splat
    If you've experience in other languages you may file RPG IV much easier to adapt to than earlier versions.

    I've yet to run into data type mismatches with code that's been converted but, yes, there are some differences between the versions and unfamiliarity with RPG IV can be off-putting.

    Good luck with it.
    7,235 pointsBadges:
    report
  • ToddN2000
    There is an opcode I have not seen in years... Yes, you can accomplish the same thing with a goto and a tag. It's a last resort for exiting a subroutine that could not be handled to exit properly due to a flaw in logic.
    11,190 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