1

I was asked this question and thought it deserved a broader audience.

Using ISPF Edit the CREATE command can create another member or dataset.

How can I create multiple members using the ISPF EDit CREATE command?

Lionel B Dyck
  • 552
  • 2
  • 9

1 Answers1

2

ISPF Edit Create can only create one member or dataset or file at a time.

But you can create an ISPF Edit Macro, which becomes and ISPF Edit command, to do this:

This is sample code to generate 3 new members based on the contents of the member being generated:

/* rexx */                
address isredit           
'macro'                   
'create a .zfirst .zlast' 
'create b .zfirst .zlast' 
'create c .zfirst .zlast' 
  1. Put this macro into a member in a library in your SYSEXEC or SYSPROC allocation.
  2. Then edit the member you want copies of
  3. And enter the Edit macro name in the command line

The 1st line in the macro tells ISPF Edit that it is written in rexx.

The 2nd line sets up the environment to the ISPF Edit environment.

The 3rd line tells ISPF Edit that this is an Edit Macro.

The 4th to 6th lines using the ISPF Edit Create command to create members A, B, and C copying from the 1st record (.zfirst) to the last record (.zlast).

hope this helps

Lionel B Dyck
  • 552
  • 2
  • 9
  • 2
    This is one of those things that even if you can't think of an immediate use case, you will one day. How about an optional parameter to control the names of the generated members e.g. DUPLICATE so DUPLICATE STEVE 1 3 will create members STEVE1, STEVE2, STEVE3. DUPLICATE STEVE X 2 will create STEVEX and STEVEY. Some sensible defaults could be implemented, such as the new member name being the current member name with an X appended (or the last character replaced by X it it's already 8 characters). – Steve Ives Jul 17 '23 at 09:51
  • 1
    @Steve - that's a great idea. I've provided a sample for the OP to solve the immediate issue. It would be trivial to extend it to satisfy your suggestion. – Lionel B Dyck Jul 17 '23 at 11:11