Path: utzoo!utgpu!watserv1!watmath!att!rutgers!psuvax1!psuvm!cunyvm!rohvm1!madif From: MADIF@ROHVM1.BITNET (Jim Foster) Newsgroups: comp.lang.rexx Subject: Re: Rexx compiler(s) Message-ID: <90243.113538MADIF@ROHVM1.BITNET> Date: 31 Aug 90 15:35:38 GMT References: <90230.092947BOYDJ@QUCDN.BITNET> <90231.095318BOYDJ@QUCDN.BITNET> <26d00a0a-3d.4comp.lang.rexx-1@tronsbox.xei.com> <90234.100626RMCCU@CUNYVM.BITNET> Organization: Rohm and Haas Company Lines: 191 In article , graham@maths.su.oz.au (Graham Matthews) says: > >I am new to this group. >What is Rexx? (I have never heard of it) > >Could someone give some examples of its use (eg: a typical >program). > >graham Here's a little program I use to write a short comment into a file on CMS. This would probably work okay on a PC. This program lets you have multiple comment files. =========================================================================== /* CM EXEC by James I. Foster Jr. Started 29 Nov 1988 15:39:38 */ /* */ /* *******************************************************************/ /* */ /* ROUTINE: CoMment */ /* */ /* PURPOSE: Add a comment to a file. */ /* */ /* AUTHOR & DATE: James I. Foster Jr., November 29, 1988 */ /* */ /* CALLS: */ /* */ /* REVISIONS: */ /* 1/4/88 - JIF: Change "escape" char to '//' instead of */ /* '|'. Fix minor bugs. */ /* */ /* *******************************************************************/ /* */ /* * Establish defaults */ hi = '1DE8'x; lo = '1D60'x /* 3270 hilighting */ EMSG = 'EXECIO 1 EMSG (STRING ASICMT' /* Prepare for error messages */ /* * Read in arguments and test for "escape" '//' characters. */ parse arg first 3 rest if first = '//' then /* "Escape" character? */ /* * When called with just the "escape" character, or the "escape" * character and a whole number, we will display the contents of * the current comment file. */ if rest = '' | datatype(rest,'W') then call DisplayFile rest /* Display the file */ else do /* Command */ /* * When called with the "escape" character and a filename, the * user can change the default comment file. */ parse var rest fn ft fm extra /* Look for a filename */ if extra ^= '' then do EMSG'001E Too many arguments. Type "CM" for help' exit 8 end if fn = '' then fn = userid() /* Setup default filename */ if ft = '' then ft = 'COMMENTS' if fm = '' then fm = 'A' /* * When called with "escape" and '?', we will show the user what * the current comment file is. */ if fn = '?' then 'GLOBALV SELECT CM LIST FN FT FM' /* Show current filename */ else 'GLOBALV SELECT CM PUTP FN FT FM' /* Remember new filename */ end /* else do */ else do /* * When the first character is not the "escape" (|) character, then * the user probably wants to add a comment to the current comment * file. If we're called with no arguments, give help to the poor * user. */ if first = '' then call SoHelpMe 'GLOBALV SELECT CM GET FN FT FM' /* Get current comment filename */ if RC ^= 0 then do EMSG'003E Surprise error from GLOBALV. RC=' RC exit RC end /* * If the user has not defined a current comment file, we will * assume a reasonable default. */ if fn = '' then fn = userid() if ft = '' then ft = 'COMMENTS' if fm = '' then fm = 'A' 'SET CMSTYPE HT' 'ESTATEW' fn ft /* See if the comment file exists */ Ret = RC 'SET CMSTYPE RT' if Ret = 28 then /* No, create the file with a header */ 'EXECIO 1 DISKW' fn ft fm '1 V (STRING' fn 'Comments:' else /* Yes (probably), add comment to file */ if Ret ^= 0 then do EMSG'002E Surprise return code from ESTATEW' fn ft 'RC=' Ret exit Ret end /* * If we're called with just a '.' then we'll add just a string * of dots to the file. This might indicate a continuation of * the previous comment. */ if first = '.' & rest = '' then parse value '.....' with Buf1 Buf2 /* This sets Buf2 to '' */ else parse arg Buf1 116 buf2 /* Only 112 characters of comment */ do while buf1 ^= '' /* per line */ 'EXECIO 1 DISKW' fn ft fm , /* Write the comment to the file */ '(FINIS STRING' date('U') substr(time(),1,5) Buf1 parse var Buf2 Buf1 116 Buf2 end end /* else do */ exit /*1 * ========== S U B R O U T I N E S F O L L O W ========== */ /********************************************************************** * This procedure will display the current comment file to the screen * **********************************************************************/ DisplayFile: procedure arg Lines /* Number of lines to display */ 'GLOBALV SELECT CM GET FN FT FM' /* Get current comment filename */ if RC ^= 0 then do EMSG'003E Surprise error from GLOBALV. RC=' RC exit RC end if fn = '' then fn = userid() if ft = '' then ft = 'COMMENTS' if fm = '' then fm = 'A' 'LISTFILE' fn ft fm '(STACK L' /* How many lines are in the file? */ parse pull . . . . . Flen . 'DESBUF' /* Kill this stack, we're done with it */ Start = 'MIN'(10,Flen) /* Default number of lines to type */ if Lines ^= "" then /* Does user say different? */ Start = 'MIN'(Lines,Flen) Start = Flen - Start + 1 /* Where do we start typing? */ 'VMFCLEAR' /* Clear the screen */ 'TYPE' fn ft fm Start /* and type the lines */ return /* from DislpayFile */ /* $TLBEG$ SOHELPME RXTOOLS 11/07/88 15:40 JIM */ /*1********************************************************************* * S O H E L P M E * ***********************************************************************/ /* Called to display help. Call SetHigh to set HI and LO first. */ SoHelpMe: procedure expose hi lo trace o call SayStart /* Simulate &BEGTYPE */ 'VMFCLEAR' /* Blank out if no clear screen desired */ /* CM - Add Comments to a comment file CM - Display this help CM // - Display last lines of file. 10 CM // - Set current comment file. COMMENTS A CM // ? - Show current comment file. CM - Add to current comment file. CM . - Add '.....' to current comment file. */ call SayEnd /* Does actual typing */ call 'DIAG' 8, RestoreVMOut exit 0 SayStart: Say@Start = SIGL + 3; return SayEnd: procedure expose Say@Start sigl hi lo trace o Say@End = sigl - 2 say hi || 'SOURCELINE'(Say@Start) || lo do I = Say@Start+1 to Say@End say ' ' || sourceline(i) end I return /* $TLEND$ SOHELPME RXTOOLS 11/07/88 15:40 JIM */ ========================================================================== -- Jim Foster - MADIF@ROHVM1.BITNET DoD #142 Rohm and Haas Company Systems Programmer 1984 NightHawk-S Independence Mall West (215) 592-2446, 592-3377 (FAX) 1987 Ninja 250 Philadelphia, PA 19105