=============================================== SEARCH400.COM DEVELOPER TIP April 25, 2001 More developer tips at: http://search400.techtarget.com/tipsIndex/0,289482,sid3_tax2f9,00.html =============================================== SPONSORED BY: Postmaster Direct =============================================== What do you like? Networks? Computer Games? Downloads? How about Free Stuff? Search400.com can get you FREE info on the topics that interest you most -- and there are so many to choose from! We'll find related news, information and special offers and deliver them directly to your e-mailbox, all at no charge! Sign up here today http://search400.techtarget.com/postmasterDirect/ ------------------------------------------------------------------ TIP OF THE MONTH CONTEST: Last week to enter to win a Garmin eMap. ------------------------------------------------------------------ This is the last week to submit a tip to win a Garmin eMap. At the end of the month we will select a winner. So, if you haven't already submitted a tip, now's the time to do it. Submit your tip now and enter to win at http://search400.techtarget.com/tipsSubmit/1,289485,sid3,00.html Once you've submitted your tip, don't forget it needs to be rated by search400 members to compete. Encourage your peers and co-workers to check it out. All tip categories can be found at http://search400.techtarget.com/tips/0,289484,sid3_tax2f7,00.html --------------------------------------------------------- Submit a program from itself By Padmanabhan Kurumpanai, search400 member Save yourself some time and aggravation by using this tip from reader Padmanabhan Kurumpanai. If you know that certain programs are very I/O intensive or process intensive, or you want them always to be submitted as a batch job for any other reason, you can achieve this from a single CL program, i.e. without writing another program to submit the program. Assume that you need to call some programs, run some queries, etc. to achieve a certain objective. You usually group them all in one CL program (SUBMIT_PGM, for e.g.) and write another CL program just to submit this, if you always want this program to run in batch, from a menu option in an application. The trick is to add the following code in the initial processing section of the CL program. RTVJOBA TYPE(&JOB_TYPE) where &JOB_TYPE is a *CHAR variable of 1 byte length. If the value of &JOB_TYPE is '1', which means the program is called interactively, the following code is added to submit the call of the same program (SUBMIT_PGM) in batch. SBMJOB CMD(CALL PGM(SUBMIT_PGM)) GOTO END_PGM where END_PGM is the label of the ENDPGM statement. The main processing section of the program is added after the SBMJOB command. The advantages of this method are twofold. First, the program saves you from writing another program to submit it. The second one, the more important one, is it prevents anyone from running the program interactively, either accidentally or deliberately. Sample Code: PGM DCL VAR(&JOB_TYPE) TYPE(*CHAR) LEN(1) RTVJOBA TYPE(&JOB_TYPE) IF COND(&JOB_TYPE = '1') THEN(DO) SBMJOB CMD(CALL PGM(SUBMIT_PGM)) GOTO END_PGM ENDDO CALL PGM(CALLED_PGM) RUNQRY QRY(QUERY_RUN) . . . . . . . . END_PGM: ENDPGM ---------------------------------------------------- OTHER DEVELOPER TIPS ---------------------------------------------------- Search400 members also submitted the following developer tips recently: Highlight source program Submitted by Michele Fini http://search400.techtarget.com/tip/1,289483,sid3_gci546451,00.html How to substitute Purchase for 'P' and 'Manufacturing' for 'M'. Submitted by Chakravarthy Palakollu http://search400.techtarget.com/tip/1,289483,sid3_gci546326,00.html A new and improved find command Submitted by Larry Pepin http://search400.techtarget.com/tip/1,289483,sid3_gci543134,00.html Using ILE Debugger on OPM programs Submitted by JR Friedman http://search400.techtarget.com/tip/1,289483,sid3_gci541694,00.html What do you think of these tips? Love them or not, we want to know. Click over to check them out and rate them. Or e- mail us at mailto:[EMAIL PROTECTED] to sound off or submit a tip of your own. ------------------------------------- FEATURED BOOK ------------------------------------- The AS/400 Programmer's Handbook, Volume II: More Tool- Box Examples for Every AS/400 Programmer Author: Mark McCall Description: Far more valuable than just code samples, each example is accompanied by a thorough line-by-line explanation of the techniques employed. As a programming tool or as a learning aid, this book is the first place to look for practical, hands-on development assistance. http://www.digitalguru.com/dgstore/product.asp?isbn=1583470123%20&ac_id=55 -------------------------------------------------------- To Remove your email address from the distribution list for this specific newsletter "Reply" to this message with REMOVE in the subject line. You will receive an email confirming that you have been removed. To Remove yourself from additional distribution lists or to update your preferences, go to the search400.com registration page at: http://search400.techtarget.com/register
