*************** Club Tech Programming Tips Newsletter *************** An AS400 Network Publication http://www.as400network.com Home of NEWS/400 Magazine Issue 26 August 30, 2000 Thanks to this issue's sponsor: T.L. Ashford BARCODE400 Software from T.L. Ashford is the simplest, fastest, and most cost-effective way to design and print barcode labels directly from your AS/400. No middleware is required. One simple low price! There are no complicated tiered pricing tables. Attach printers to the AS/400 via TCP, Twinax, etc. http://www.tlashford.com/news400 ****************************************************************** THIS WEEK: > CGI Sample Code for ILE RPG and ILE Cobol > Incorporate the Command Line into an Application > Change SIZE Parameter Default to *NOMAX > Display the Command String > Modify IBM Edit Codes Featured Tip: CGI SAMPLE CODE FOR ILE RPG AND ILE COBOL Common Gateway Interface (CGI) programs are invoked in response to a user request from a remote Web browser, and they are able to read data passed from the browser and generate HTML output on the fly, allowing you to create dynamic and interactive Web pages. On the AS/400, CGI programs can be written in C++, ILE C, ILE Cobol, and ILE RPG. To get started in writing CGI programs, it's helpful to begin with working sample CGI code. Here are some resources where you can find sample ILE RPG code: Tech Studio Code Snippets IBM Rochester http://www.as400.ibm.com/net.data/tstudio/workshop/snippets/newsnip.mac/viewall Easy as /400 Open Source Applications IBM Italy http://www.easy400.ibm.it/ "Custom APIs Boost CGI Program Performance" NEWS/400, July 1999 http://www.as400network.com/article.cfm?ID=3074 "Develop an RPG CGI Application" NEWS/400, January 1997 http://www.as400network.com/article.cfm?ID=1857 "Develop an RPG CGI Application: Building Dynamic Web Pages" NEWS/400, July 1997 http://www.as400network.com/article.cfm?ID=2128 Various RPGLE sample code BVS Tools http://www.netshare400.com/cgi-bin/DSPSAMP A recent upload to the Cobol Community at http://www.as400network.com/communities/cobol/ contains the following ILE Cobol code: ILE Cobol CGI Examples Authored by Eduardo Murra Farrus http://www.as400network.com/communities/cobol/CobolCode/IleCobolCgiExample.zip Note that only AS400 Network professional members can read the above three NEWS/400 articles, but anyone can download the sample CGI code from those articles at http://www.as400network.com/resources/code/ . Short Takes: 1. INCORPORATE THE COMMAND LINE INTO AN APPLICATION Q. I want to replace an AS/400 menu with a menu program that looks and works like the original menu. How can I replicate the AS/400 command line in my program, including the ability to retrieve previous commands using F9? A. You should check out a NEWS/400 article published way back in May 1995 titled "A Command Line from Anywhere." The article includes CL program CMDLINE, which uses APIs QMHRTVRQ, QCAPCMD, and QMHMOVPM to provide a fully functional command line that you can incorporate into your application. CMDLINE, like the AS/400's command line, can do the following: a. Provide an input field into which the user can type OS/400 command strings. b. When the user presses F4, invoke the CL command prompter using the entered command string; add the changes entered through the prompter to the command string. c. Check any entered command string for valid CL syntax. d. Determine whether the current user profile has limited capability (LMTCPB(*YES)) and, if so, whether the entered command string is valid under limited capability. e. Execute any command string that is valid under items 3 and 4. f. Display on the screen's message line all messages returned from the command string execution. g. Save all executed command strings, including the changes entered through the prompter, to the job message queue. h. When the user presses F9, retrieve the previously executed command string from the job message queue and display it in the command line input field. i. When the user presses F9 repeatedly, retrieve previous command strings in descending order of execution. The NEWS/400 article also provides a sample RPG program that demonstrates how to integrate a fully functional command line into a standard work-with screen. Note that only AS400 Network professional members can read the above NEWS/400 article, but anyone can download the code at http://www.as400network.com/resources/code/ . 2. CHANGE SIZE PARAMETER DEFAULT TO *NOMAX Q. Every time I create a physical file, I'd like the default value for the SIZE parameter to be *NOMAX. How do I do this? A. Use the Change Command Default (CHGCMDDFT) command to change the default value for CRTPF's SIZE parameter. Beware, though, that if you specify *NOMAX without specifying the other two elements in the list, you'll run into a snag -- the attempt fails with diagnostic message CPD6273 ("Single value not valid default value"), which has a severity level of 40. You then get escape message CPF6260 ("Errors detected while changing defaults"), which aborts the attempt. The solution is to specify all three values for the SIZE parameter, like this: CHGCMDDFT CMD(CRTPF) NEWDFT('SIZE(*NOMAX () ())') or like this: CHGCMDDFT CMD(CRTPF) NEWDFT('SIZE(*NOMAX *N *N)') where *N represents a null value. *NOMAX is now the first of three values; although the other two values are null, they have been specified. Use *NOMAX in the SIZE parameter with caution, as a runaway job could eat up all your DASD. Answer adapted from a Tech Corner item by Gary Guthrie 3. DISPLAY THE COMMAND STRING When you use CL command prompter (F4) to enter a command, you don't need to exit and press F9 to retrieve the command to view the command string. You can simply press F14 while you're still in the command's prompt screen to display the command string. 4. MODIFY IBM EDIT CODES Q. Can I modify the IBM-shipped edit codes 5 through 9, or is that not permitted because an OS/400 program uses them? I want to use edit code 9 to display a YYMMD date format from a six-digit field. A. Yes, you can modify edit codes 5 through 9 for your own purposes although IBM predefines them. To work with edit descriptions, type GO CMDEDTD at an AS/400 command line to display a list of the available edit description commands. Note that you can't actually modify the edit description; instead, you must delete it with the DLTEDTD command and then create a new one with the CRTEDTD command. You can find more information about creating user-defined edit descriptions in Application Display Programming (SC41-5715). As an alternative to changing the user-defined edit descriptions, you might consider using edit words. Edit words provide maximum flexibility in creating edit masks. Answered by Gary Guthrie ************************** ADVERTISING **************************: GET AS/400 TRAINING WITHOUT LEAVING YOUR HOME OR OFFICE! You probably can't afford your own personal tutor or a high-priced consultant to teach you AS/400 skills. But you can afford Automated Training Systems' unique training packages. Using audiocassettes, interactive media, and workbooks, ATS brings qualified instructors right to your desktop! With more than 45 courses, ATS has a package for every subject area; try us and see! For more information: http://www.as400network.com/str/ats/regform.cfm . ********** ABOUT CLUB TECH PROGRAMMING TIPS NEWSLETTER **********: Club Tech Programming Tips Newsletter is published every other Wednesday. We publish Club Tech Systems Management Newsletter on alternate Wednesdays. Also from NEWS/400, NEWSWire/400 is published Tuesdays and Thursdays and covers the latest AS/400 industry news. NEWSWire/400 Product Extra is published Mondays and contains the latest new product announcements. All are *FREE OF CHARGE*! FOR NEW SUBSCRIPTIONS, you can subscribe by joining the AS400 Network with a handy Web form at http://www.as400network.com/join/ . TO UNSUBSCRIBE or CHANGE E-MAIL ADDRESSES, go to http://www.as400network.com/info/profile/profilelogin.cfm . If you don't have Web access, you can also unsubscribe to this newsletter (without unsubscribing to NEWSWire/400) by replying to this message with UNSUBSCRIBE in the Subject line. You are subscribed as tadashi@ff.iij4u.or.jp IF YOU HAVE a technical question, please submit it to clubtech@as400network.com or post it in the appropriate as400network.com forum. If you have a response to a tip in this newsletter, please e-mail clubtech@as400network.com . IF YOU WANT TO SPONSOR a Club Tech Programming Tips Newsletter, please contact your AS400 Network sales manager. Click here for details: http://www.as400network.com/info/mediakit/Sales/Index.htm . ___________________________ Copyright 2000, NEWS/400 http://www.as400network.com
|
|||
|
|