So we're upgrading SEASOFT Fastpack and have to add members to everyone's ISPF profile to allow the usage of the product's menu.
The ideal JCL we're after is as follows:
//COPYRGHT JOBCARD
//JOBSTEP EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//INDD DD DSNAME=FASTPACK.SRC,
// DISP=SHR,UNIT=SYSDA
//OUTDD DD DSNAME=BFCU.PRODISPF.PROF&SYSNAME..&USERID <==== ? BFCU.PRODISPF.PROF*.*
// DISP=SHR,UNIT=SYSDA
//SYSIN DD *
COPY INDD=OUTDD,OUTDD=OUTDD
COPY INDD=((INDD,R)),OUTDD=OUTDD
/*
Obviously it would be nice if we can make the job dynamically look for all the datasets that match the pattern.
I would suggest writing Rexx or clist code to use the LMDINIT and LMDLIST ISPF services to create a list of datasets matching your pattern and save the list in a dataset. Then write another program to read that list of datasets and write your desired JCL, one step per dataset. Run the Rexx or clist code in ISPF in batch.
You will want to count how many steps you generate, as a job can only have 255 steps.
You can make this as automated as you like, for example you could generate a jobcard, an instream proc containing your IEBCOPY with the OUTDD DSN a parameter, and then each step executes the instream proc with the DSN parameter set to the dataset name. When you get to 255 steps, generate another jobcard, another copy of the instream proc, and continue with generating steps.