I rely on a REXX EXEC as shown below to create TSO allocate commands for PDSE libraries corresponding to every PDS library matching a library name pattern (optionally skipping older PDS libraries by creation date). The VSAM DEFINE subroutine can be removed. This is executed with JCL, the allocate commands are then saved to a sequential dataset (FB 80), modified, and then executed with another JCL. Then the copy JCL needs to be coded and executed, and maybe the new and old libraries will need to be renamed. Some of that could probably also be partially automated by adding more code to this to REXX exec to create the copy and rename or delete commands, if anyone is interested.
/* REXX */
cat_dsn.0 = 0
/* Note: creation date not available for some VSAM */
/* Creation date day in Year/day format, for example: 1985/102 */
startyear = ''
afterday = ''
Call CATLIST('data'set name pattern here')
DO dsn# = 1 TO cat_dsn.0
dsn = cat_dsn.dsn#
rc = LISTDSI("'"||dsn||"'" 'DIRECTORY')
If rc > 0 Then Do
IF SYSDSORG == 'VS' Then Call VSAM(dsn)
Iterate
End
/* For converting PDS to PDSE format, skip all PDSE */
/*If SYSDSSMS == 'PDSE' Then Iterate */
If afterday <> '' Then Do
cryear = Left(SYSCREATE,4)
/* skip everything created before startyear */
If cryear < startyear Then Iterate
If cryear == startyear Then Do
crday = Right(SYSCREATE,3)
/* skip everything created on or before specified afterday */
If crday <= afterday Then Iterate
End
End
IF LENGTH(SYSRECFM) > 1 THEN DO
RECFM1 = SUBSTR(SYSRECFM,1,1)
RECFM2 = SUBSTR(SYSRECFM,2,1)
RECFM = RECFM1||' '||RECFM2
END
ELSE RECFM = SYSRECFM
IF LENGTH(SYSRECFM) > 2 THEN Do
RECFM3 = SUBSTR(SYSRECFM,3,1)
RECFM = RECFM||' '||RECFM3
END
USED = ((SYSEXTENTS - 1) * SYSSECONDS) + SYSPRIMARY
IF SYSDSORG == 'PO' THEN DIR = 'DSORG(PO) DSNTYPE(LIBRARY,2) +'
IF SYSDSORG == 'DA' THEN DIR = 'DSORG(DA) +'
IF SYSUNITS == 'BLOCK' THEN SYSUNITS = 'BLOCK('||SYSBLKSIZE||')'
Say 'ALLOCATE DATASET('||DSN||') NEW +'
Say 'UNIT('||SYSUNIT||') +'
Say 'SPACE('||USED||','||SYSSECONDS||') '||SYSUNITS||' +'
Say DIR
Say 'RECFM('||RECFM||') +'
Say 'LRECL('||SYSLRECL||') +'
Say 'BLKSIZE('||SYSBLKSIZE||') +'
Say 'CATALOG'
Say 'FREE DATASET('||DSN||') KEEP'
End
exit 0
CATLIST:
PROCEDURE EXPOSE cat_dsn.
ARG mask
/* Set command environment to ISPEXEC */
cmdenv = ADDRESS()
"SUBCOM ISPEXEC"
IF rc ¬= 0 THEN DO
SAY "ISPF must be active to run this exec"
EXIT 8
END
ADDRESS ISPEXEC
i = 0
/* Initialize data set list-ID */
"LMDINIT LISTID(listid) LEVEL("mask")"
IF rc ¬= 0 THEN DO
SAY "LMDINIT error for '"mask"' - RC =" rc
EXIT 16
END
dsn = ""
/* Add each data set to list */
DO WHILE rc = 0
"LMDLIST LISTID("listid") OPTION(LIST) DATASET(dsn)"
IF rc == 4 | rc == 8 THEN
LEAVE
IF rc ¬= 0 THEN DO
SAY "LMDLIST error for '"mask"' - RC =" rc
EXIT 16
END
cat_dsn.0 = cat_dsn.0 + 1
i = i + 1
cat_dsn.i = dsn
END
/*
Free data set list-ID */
"LMDFREE LISTID("listid")"
IF rc ¬= 0 THEN DO
SAY "LMDFREE error for '"mask"' - RC =" rc
EXIT 16
END
/* Reset caller's command environment */
ADDRESS VALUE cmdenv
RETURN
VSAM:
ARG dsname
If Right(dsname,5) == '.DATA' Then Return
If Right(dsname,6) == '.INDEX' Then Return
Say 'DEFINE CLUSTER (NAME('dsname') +'
Say ' SHAREOPTIONS(3,3) +'
Say ' STORAGECLASS(SCPRD01) MANAGEMENTCLASS(MCPR2201) +'
Say ' DATACLASS(DCDEFALT) MODEL('dsname'))'
RETURN
Original Message:
Sent: 04-18-2016 05:10 PM
From: Felicity Vaughan
Subject: PDS to PDSE CONVERSION
I am aware that there is a BSTXCOPY utility from CA to assisst with copying PDSs to PDSEs, however, I have literally thousands of PDSs that need to be converted and I'm looking for a way to do this automagically. I don't want to have to look at each dataset, figure out what the space, etc should be so that I can enter that information to create the new PDSE. None of the utilities I've found anywhere, have a way to clone an existing PDS as a PDSE. Does anyone know if anything like this exists?