This is a great question... It shows that you are getting into the guts of the way the system works and are gaining a better understanding of the way the programs are coded to be executed from the task definitions...

The Initial Return Code field is used to populate the L#RTCD field which is actually position 118 - 119 of the LDA (Local Data Area)... Use the WRKLDA command from any command line in JBA to see/change the current value of this field in your LDA...

Look for those tasks where the same program is called with different Initial Return Codes, If you look closely at the RPG code you will find that the RPG programs will behave differently based on what is found in the L#RTCD field (This field may have different names but is always 118-119 of the LDA...)

When the Task is first launched the L#RTCD field is populated with whatever is found in the Initial Return Code as defined in the Task... The value in L#RTCD can be manipulated by any program at any time so that's why they call it the "Initial" Return Code...

A more subtle feature is found when you have an Interactive Program defined in a Task along with a Batch Program... The Initial Return Code value is fed to the Interactive Program defined in the Task. It is up to the Interactive Program to feed the correct value into the L#RTCD field to trigger the calling of the Batch Program found in the Task definition. The Application Manager will only run the Batch Program if the L#RTCD field contains a " Y" (that's a "blank" followed by a capital "Y") in position 118-119...!!! So you will typically find that when the user is prompted to Press F8 to submit, in the RPG code the L#RTCD field is populated with a "Blank" "Y"...!!! If the user presses F3 to exit without submitting the L#RTCD field is typically cleared or pobulated with anything other than "blank "Y" and the Application Manager recognizes that it should not submit the Batch Portion of the Task Definition...

You will also find the return code field used to pass "results" between calling programs... If program IN123 calls program MD123 it would not be surprising to see IN123 populate the L#RTCD field with some meaningful value before calling MD123... Even more likely to see it test the "result" of the call to MD123 after the call "RETURNS" control from MD123 to IN123 by testing the contents of L#RTCD...

Another example that is common in JBA code is found when external calls are expected to be made from an interactive program. It is common practice to leave those externally called programs running in the call stack after the first call and only close them when the Interactive program terminates... This is much more efficient than opening and closing those programs every time you call them... Issuing a Call to a program with "LR" in the L#RTCD field as the interactive program ends would be a typical code segment to find in a case like this... The Called program would then realize it should terminate itself...

The Return code field is a very important and versatile field in the JBA code... It's important to be aware of the many ways it is used if you're planning to customize existing code and even more important if you're planning to write your own "Task Friendly" custom modules that will run under Application Manager...

Great question...

Good luck...

----Original Message Follows----
From: Meena Nayagam <meenanayagam@xxxxxxxxxxx>
Reply-To: System 21 Users <system21@xxxxxxxxxxxx>
To: system21@xxxxxxxxxxxx, jbausers-l@xxxxxxxxxxxx
Subject: [SYSTEM21]   Return code in Maintain Tasks
Date: Tue, 16 Dec 2003 15:57:24 +0000 (GMT)


I have one question related to the return code while defining the tasks in Manager/400(Maintain tasks option). What is the significance of this return code ? Will it be the input paramater to the Interactive program that called ? I have observed that we have different tasks calling the same program but with different return codes. So I believe it should be an input to the program.


Pls let me know more about this.

Regards,

Meena

_________________________________________________________________
Our best dial-up offer is back. Get MSN Dial-up Internet Service for 6 months @ $9.95/month now! http://join.msn.com/?page=dept/dialup



This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].