 This exec shows a method of imbedding panels and messages right in an exec, so that you don't have to ship a separate panel or message library. The exec is a bit long, but well worth looking at. The same technique can be applied to load modules, but to do that, you must create a method of including panels in the module. To save space when you ship panels imbedded in a load module, keep the panels in ISPF packed format. We now have a sample of how to do this in a load module! The sample includes the program to generate the panel/message/skeleton images to include in your application, as well as the routine to link in to your program to reconstitute the library. |
/*************************************************************REXX***//*REXX Edit macro showing how to create a panel, display it, and *//* use input from that panel. This makes it possible to *//* ship an exec with panels imbedded in the exec file. *//* This example also includes imbedded messages. *//* This example runs on the latest ISPF releases for CMS and *//* TSO. *//* *//* Panels are imbedded at the end of the exec in comments. *//* The comments are of the form: *//* /+PANEL panelname *//* panel or message definition *//* +/ *//* where /+ and +/ are really REXX comment delimiters in col 1 *//* *//* Although this is shown as an edit macro, the method used *//* is not dependent on any edit macro facilities. *//* *//* The method used is: *//* 1) Create a temporary panel library (PDS on MVS, flat *//* files on CMS) *//* 2) use LIBDEF to point to the new panel/message library. *//* 3) Display the panel, which will set some variables. *//* 4) Use LIBDEF again to clean up. *//********************************************************************/Address 'ISPEXEC''ISREDIT MACRO (DSN)'Parse Source system . cmdname .Call createlib'ISREDIT LINE_BEFORE .ZFIRST = (LINE3)''ISREDIT LINE_BEFORE .ZFIRST = (LINE2)''ISREDIT LINE_BEFORE .ZFIRST = (LINE1)''ISREDIT LOCATE .ZFIRST'Exit 1/**** createlib: Create and display a temporary panel ***************/createlib:exec_line=1 /* Start looking for imbeds at line 1 of the exec */if system = 'TSO' then Address tso 'ALLOC NEW CAT F($TMPLIB$) DSO(PO) DIR(1) SP(3,3) TRACK da($WWWSAMP.TEMP.ISPFLIB) REUSE RECFM(F B) BLKSIZE(0) LRECL(80) UNIT(SYSALLDA)'Call make_member /* call make_member once for each imbedded member*/Call make_memberCall make_memberif system = 'TSO' then Address tso 'ALLOC F($TMPLIB$) OLD DA($WWWSAMP.TEMP.ISPFLIB) REUSE'if system = 'TSO' then do 'VGET ZENVIR' If substr(zenvir,6,1)>='4' Then stack='STACK' /* Use STACK in V4 */ Else stack = '' 'LIBDEF ISPPLIB LIBRARY ID($TMPLIB$)' stack 'LIBDEF ISPMLIB LIBRARY ID($TMPLIB$)' stack endelse /* do CMS style libdef */ Do 'LIBDEF ISPPLIB FILE ID(ISRNULL $TMPLIB$ A)' 'LIBDEF ISPMLIB FILE ID(ISRNULL $TMPLIB$ A)' END'ADDPOP'Do Until rc>0 'DISPLAY PANEL(TEMPPAN)'End'REMPOP''LIBDEF ISPPLIB ''LIBDEF ISPMLIB 'if system = 'TSO' then Address tso 'FREE F($TMPLIB$) DELETE'Else Address '' 'ERASE * $TMPLIB$ A 'Do queued();Pull;EndReturn/* make_member: scan this exec for imbedded parts and add to temporary *//* library using EXECIO for I/O operations. */make_member:Do queued();Pull;EndDo Until substr(line,1,7)='/*PANEL' line = sourceline(exec_line) exec_line=exec_line+1EndParse Var line . panelname .Do until substr(line,1,2)='*/' line = sourceline(exec_line) if substr(line,1,2)^='*/' then Queue line exec_line=exec_line+1Endif system = 'TSO' then do pands='$WWWSAMP.TEMP.ISPFLIB('panelname')' Address tso 'ALLOC OLD F($TMPLIB$) DSO(PO) DIR(1) SP(3,3) TRACK da('pands') RECFM(F B) BLKSIZE(0) LRECL(80) REUSE UNIT(SYSALLDA)' Address 'TSO' 'EXECIO 'queued()' DISKW $TMPLIB$ ( FINIS' endelse do Address '' 'ERASE 'panelname' $TMPLIB$ A ' Address '' 'EXECIO 'queued()' DISKW 'panelname' $TMPLIB$ A 1 F ( FINIS' endDo queued();Pull;EndReturn/*PANEL TEMPPAN)BODY WINDOW(73,12) CMD(ZCMD)%Command ===>_ZCMD %+ This is a sample temporary panel defined in the &cmdname exec file.+ Enter data for line 1%===>_line1 ++ Enter data for line 2%===>_line2 ++ Enter data for line 3%===>_line3 ++Enter%HELP+on the command line to show a temporary help panel.+Enter or press%END+to leave this panel.)INIT .HELP = TEMPPANT .MSG = TEMP001)END*//*PANEL TEMPPANT)BODY WINDOW(35,5) CMD()%+ This is a%temporary+help panel.)END*//*PANEL TEMP00TEMP001 'Here is a message''This is a temporary message from the exec'*/ |