MCIT Technical Newsletter #3

CUT & PASTE Edit Macros

 

        ISPF is probably the most powerful and widely used text editor in existence,
     as anyone who has ever also used UNIX's vi or the old PC edlin can testify. 
     Somehow IBM managed to avoid adding the useful cut and paste functionality to
     ISPF.  They did however provide the edit macro facility that can be used to
     implement cut and paste functions.  There is a set of CUT and PASTE edit macros
     that are available on the mainframe, but they are limited in their usefulness
     because they can not cut and paste between applications.  They are also cumbersome
     to use because of size limits and the destructive nature of the paste macro.
     For example, try using the PASTE macro twice.  Frequently an ISPF user needs to
     cut from a member in a PDS and paste into a LIBRARIAN member.  A more user friendly
     set of edit macros is now available for general use in MCIT.  There are actually
     two sets of macros that function identically except that they store their cut
     data into separate QSAM files to enable cutting and pasting of two different sets
     of data.  The use of a QSAM file, rather than the ISPF PROFILE, to store the cut
     data, cut and paste between applications is enabled.  An obvious use of two
     independent sets of cut and paste macros is the ability to cut and paste 'WORKING-STORAGE'
     data separately from 'PROCEDURE DIVISION' code.  The first set of cut and paste
     macros consists of DRC (cut), DRP (paste), & DRA (append).
     The second set is DRC2, DRP2, and DRA2.  The following
     discussion uses DRC, DRP, and DRA, but it applies to the DRC2 set also.  

        The DRC macro copies or moves a set of records from a member in edit mode and
     stores them into a permanent disk file, 'userid.CUTPASTE.DATA'.  The DRP macro
     can then be used to copy the stored set of records into any other member in edit
     mode.  Since the DRC macro is destructive, a third macro, DRA, is available to
     add blocks of records to the end of any previously cut records.  DRC and DRA use
     the ISPF line commands C, Cn, CC, M, Mn, and MM to designate which records to 
     store.  DRP uses the line commands A and B to designate where to paste the stored
     records.  Since the DRP macro is NOT destructive, the same cut records can be
     pasted as many times as necessary without re-cutting.  A benefit of storing the 
     cut records on permanent disk files also enables a user to paste records from 
     previous ISPF sessions, days or even years apart.  Another benefit of the disk
     file is the ability to edit it after cutting and before pasting.  All of the macros
     will display a help screen when invoked within the ISPF editor as a primary 
     command with the parameter ?.  There is no limit on the number of records that
     can be cut from a member except for the limit based on the physical size of the
     QSAM file.  The default allocation is (TRK,(3,1)), but a file of any size may be
     pre-allocated to allow for cutting very large blocks of records.