
SYSTEM BY THOMAS BRYANT & JEFFREY CELANDER STRATEGIES ISPF/PDF Edit Macros By Example SPF/PDF contains a useful feature that allows you to write and execute macros for use with the PDF editor. To a user, there is little difference between an ISPF edit command and an edit macro. In fact, edit macros Iare executed the same way as edit commands. You type the macro name in the command field on the edit display, along with any operands that are This article examines required, then press the ENTER key. some simple ISPF/PDF edit macros that will Edit macros allow you to create your own ■ Use the CLIST &STR function if string allow you to create your editor commands or replace existing editor data contains arithmetic or logical own editor commands commands. An extremely useful feature operators. allows an initial macro to be executed when ■ If a variable containing leading/trailing or replace existing ones. edit is invoked. This type of macro receives blanks is used in a comparison, the control after the editor has read the data, but blanks are ignored. prior to the display of the data. ■ Use the variable &LASTCC to check Inside macros, you have access to the data the return code of the previous lines being edited. You have access to cursor command. Remember that its value position and screen window locations at your is changed at the end of each command. fingertips. You can access edit modes and ■ CLIST statements must be written other related editor information. Within edit in uppercase. macros, you can access data contained outside ■ A variable must be assigned a value of the edit session using ISPF file services. before it can be used. ISPF dialog services are also available. Edit ■ A “+” or “-” at the end of a line serves macros provide raw editing power just waiting as a continuation character. The “+” to be tapped. What makes them even more deletes leading blanks from the following powerful is that they are simple to write. line. A “-” leaves the leading blanks. This article examines some simple edit macros that can save you time. This article Macros can be written in REXX, CLIST, assumes that you are familiar with the CLIST or compiled or assembled languages. If you language, since most elementary ISPF/PDF don’t understand everything contained in the edit macros are created using CLIST. We will macros that follow, additional information save the use of REXX and PROGRAM edit is provided in the IBM Interactive Productivity macros for a future article. Facility/Program Development Facility The following helpful hints will save the (ISPF/PDF) Edit Macros Guide. inexperienced CLIST edit macro writer from Macro lines that begin with ISREDIT are the pain and suffering we have experienced. edit commands, and are documented in the reference manual. Every edit macro must ■ CLIST does not allow mixed strings include an ISREDIT MACRO statement. The (strings with EBCDIC and DBCS CLIST PROC statement should not be coded characters). at the beginning of your macros. The last ■ The CLIST ERROR statement can be statement should be the CLIST EXIT state- used to capture any non-zero return code. ment. The EXIT statement is not required, but ■ The CLIST preprocessor interprets we include it to clearly identify the end of the each statement before the statement macro. Indentation should always be used to is handed over to the editor. show the structure of the macro. TECHNICAL SUPPORT FEBRUARY 1996 SYSTEM STRATEGIES Figure 1: Edit Macro to Convert Figure 3: Edit Macro to Find and Highlight Words Figure 4: SB: Edit Macro to Lowercase to Uppercase Perform a Full-Screen Submit ISREDIT MACRO (WORD1 WORD2) ISREDIT EXCLUDE ALL ISREDIT MACRO ISREDIT MACRO ISREDIT RESET IF &STR(&WORD1) ^= THEN ISREDIT FIND ALL `&WORD1’ CONTROL NOFLUSH ISREDIT CAPS=ON IF &STR(&WORD2) ^= THEN ISREDIT FIND ALL `&WORD2’ ISREDIT C P’<` P’>` ALL SET &ZEDSMSG = &STR(Scan Completed) ISREDIT SAVE EXIT CODE(0) SET &ZEDLMSG = &STR(Lines with &WORD1, &WORD2 remain displayed) ISREDIT (DSN) = DATAS E T ISPEXEC SETMSG MSG(ISRZ000) ISREDIT (MBR) = MEMBER EXIT CODE(0) Figure 2: Edit Macro to Convert SET &SUBDSN = &STR(&DSN.(&MBR.)) Blank Lines to Comments IF &STR(&MBR) = &STR() THEN + Figure 5: Using the SB Edit Macro SET &SUBDSN = &STR(&DSN) ISREDIT MACRO SET SYSOUTTRAP = 1 EDIT PDTOMB.UTILITY.JCL(DELETEIT) - 01.04 JOB SUBMITTED SET &XX = N SUBMIT ‘&SUBDSN’ DO WHILE &XX = N Command ===> Scroll ===> PAGE ISREDIT FIND ` 40 spaces ‘ 1 40 IKJ56250I JOB PDTOMBB(JOB04416) SUBMITTED SET &SUBRC EQ &STR(&LASTCC) SET &RETCODE = &LASTCC 000001 //PDTOMBB JOB (XXXX-XXX-XXX),’IEFBR14’,CLASS=A,MSGCLASS=X, SET SYSOUTTRAP = 0 IF &RETCODE = 0 THEN + 000002 // MSGLEVEL=(1,1),NOTIFY=PDTOMB,TYPRUN=HOLD SET &ZEDSMSG = &STR(JOB SUBMITTED) 000003 //* ISREDIT CHANGE ` ` `*’ 1 SET &ZEDLMSG = &STR(&SYSOUTLINE1) ELSE + 000004 //STEP01 EXEC PGM=IEFBR14 SET &XX = Y 000005 //SYSUT1 DD DSN=PDTOMB.OLD.FILE, ISPEXEC SETMSG MSG(ISRZ000) END 000006 // DISP=(MOD,DELETE,DELETE) EXIT CODE(1) EXIT CODE(0) 000016 // ***************************** Bottom of Data *************************** General purpose macros are often required.These macros are IKJ56250I JOB YOURJOB(J????) passed parameters to indicate data to be processed.The macro will SUBMITTED *** generally retrieve or change information known to the editor.The ma c r o may ret u r n a simple message back to the user or alter the editor We decided to write a edit macro to do a full-screen submit. This screen display. required a bit of experimenting with the TSO SUBMIT command to The macro in Figure 1 is a classic example of a simple general see how it works. Figure 4 presents the small, but effective, edit macro p u rpose macro. Shops that use the IBM high-level A s s e m bl e r we ended up with. (ASM90) and As s e m b ler H (IEV90) sometimes run into compati b i l i t y For Figure 4, we want to make sure the edit macro does not problems. The ASM90 assembler accepts lowercase characters in prematurely end due to a non-zero return code.We supply the non-comment words while the IEV90 assembler does not. CONTROL NOFLUSH to prevent flushing of the TSO input stack in Getting a program written to use the ASM90 assembler to run on this case.We will discuss the ISREDIT SAVE a little later. the IEV90 assembler requires some source code editing.The edit The edit macro facilities for DATASET and MEMBER will extract macro in Figure 1 does the job.The ISREDIT MACRO statement the current data set and member you are editing to build the data set starts the macro. The ISREDIT RESET statement performs the same name for the TSO SUBMIT. TSO SYSOUT trapping is used to get the function as the editor RESET command.This command will reset the JOB SUBMITTED message. The ISPF/PDF defined the short message status of all lines and delete special non-data lines. Line labels are not (&ZEDSMSG) to JOB SUBMITTED and the long message removed.The ISREDIT CAPS=ON command sets the CAPS mode to (&ZEDLMSG) to the SYSOUTLINE1 is trapped. If the user pressed ON.The next line issues a CHANGE command against all data lines HELP (PF1), see Figure 5. to convert lowercase characters to uppercase.The last line is the We prefer to set the EXIT return code to 1 so the cursor will be CLIST EXIT statement that signals the end of the macro. placed at the command line and the command line will be blanked. The macro in Fig u r e 2 illustrates the use of control logic in an edit The ISREDIT SAVE must be issued since the TSO SUBMIT goes ma c r o. This macro was crea ted to assist program m e r s to conver t bla n k against the disk copy of the data set and not the in-memory copy. lines contained in ASM90 assembler programs to comment lines for use Just recently, Tom Bryant had to edit out an ascending number by the IEV90 assemble r . The function of this macro can be rever sed to sequence.This sequence had the same column numbers for each co n ver t “ * ”o n ly lines to blank lines by simply cha n g ing the FIND com- occurrence of the .SYNC character string we use for our Platinum mand and CHANGE command arguments. This macro could also be batch processor command. All .SYNC XXX (where xxx is the mo d i f ied to conver t assembler SPACE commands to blank lines. ascending number sequence) was to be changed to QQQQ. Once this The macro in Figure 3 shows how you can use an edit macro to is done, some simple editing could be performed to change all occur- accept parameters. The EXCLUDE ALL command is also used to rences of this value. See Figures 6 and 7. illustrate how all lines in an edit session can be excluded from the dis- E a ch time we find a .SYNC stri n g, we take the current line play then included on the display by a FIND command positive ( rep resented by the .ZCSR va ri able) and use a templat e. The match. This technique shows how to center the focus on the data the t e m p l ate will unconditionally ch a n ge the four ch a ra c t e rs fro m user wants to see. columns 7 through 10 to the ch a racter string ‘QQQQ’. The fi n a l The SET &ZEDSMSG = ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-