rpgle in as400

1395 pts.
Tags:
RPGLE Program
how to end the program without using seton lr and return opcode..

Answer Wiki

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

Here are two methods that the old timers don’t of. I can think of at least 100 ways to end a program with out using seton lr and return opcode. The first one being the ENDPGM command.

Method 1
SEND ESCAPE MESSAGE.

Method 2
For files using the cycle you don’t need a return. IE a file is defined as input primary.

Don’t use methods..
There are other ways but I’d prefer you didn’t do them. Like deallocalte a null address will cause a message sent to qsysopr and you can answer the message with a C.

Discuss This Question: 15  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
  • CharlieBrowne
    Can you explain why you would want to do this. What are you trying to accomplish?
    41,380 pointsBadges:
    report
  • Vatchy
    You can't. The program won't compile without one or the other.
    1,410 pointsBadges:
    report
  • WoodEngineer
    This is indeed an unusual request. You could force a fatal error but the program would not end gracefully. For example, divide by zero. If called from a CL program you could code the call to ignore the error. As Charlie Brown asks, "What are you trying to accomplish?"
    6,715 pointsBadges:
    report
  • TomLiotta
    Assuming that the program is compiled as ACTGRP(<name>), then RCLACTGRP ACTGRP(<name>) will end it if it's run from the same job that ran the program. What problem are you trying to solve? Best is probably to call the program with an additional parameter that tells the program that it's time to end. Then use *inLR in that program and RETURN. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Is this a trick queston? It's not my style but 1. Return is not necessary. Run out of code in the main and the program returns. 2. Completion of (P)rimary file processing will turn on the *INLR without the code doing anything to *INLR. A Primary file has a 'P' in the f-spec for File Designation. Phil .Phil
    50,385 pointsBadges:
    report
  • TomLiotta
    Completion of (P)rimary file processing... There is a slight addition to that, depending on whether End-of-File is set as blank or 'E' and whether or not there are (S)econdary files. But it's basically correct. So many options... Tom
    125,585 pointsBadges:
    report
  • pdraebel
    Sending an Escape message from the program should do the trick.
    3,030 pointsBadges:
    report
  • philpl1jb
    RAJASEKHAR Please let us know.is these responses serve your needs. If these don't help, please give us a clearer idea of the situations and what you are trying to achieve. Phil
    50,385 pointsBadges:
    report
  • Rajasekhar15
    sorry guys, sorry for late reply, no im asking whether is there any possibilities to do it ,
    1,395 pointsBadges:
    report
  • TomLiotta
    im asking whether is there any possibilities to do it As shown by multiple comments, there are numerous ways to do it. Different ways can have different side-effects, e.g., sending an *ESCAPE message might have very different results from reaching End-of-File on a primary file even though both methods (and others) can end a program without SETON LR. A choice of method should take into account the results that are desired. Tom
    125,585 pointsBadges:
    report
  • Rajasekhar15
    [...] Rajasekhar15 asks a question that riles up the AS/400 [...]
    0 pointsBadges:
    report
  • Yorkshireman
    Sounds like an interview question to me... - Just sayin'
    5,580 pointsBadges:
    report
  • Yorkshireman
    Oh - and dws400 - what are the other 98 ways ??
    5,580 pointsBadges:
    report
  • Splat
    [...] is there any possibilities to do it The question still remains, why would you want to?
    7,395 pointsBadges:
    report
  • Rajasekhar15
    [...] Rajasekhar15 asks a question that riles up the AS/400 [...]
    0 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