I need to prepare a JCL step that copy a dataset into a new dataset but ONLY if this new dataset not already exist.
So I thinking about something like that:
Code: Select all
//COPYDS EXEC PGM=IDCAMS
//*
//SORTIN DD DSN=source,DISP=SHR
//*
//SORTOUT DD DSN=dest,DISP=(MOD,CATLG),
// SPACE=(CYL,(1,1),RLSE)
//
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT INDATASET(dest) -
DUMP COUNT(001)
IF LASTCC > 00 THEN -
IF LASTCC < 13 THEN DO
SET MAXCC=0
REPRO INFILE(SORTIN) -
OUTFILE(SORTOUT)
END
/*
If I use OUTDASET instead I receave an erro because the dataset in not allocated...
So my questions are:
1) Is There better way to know if dataset exist and not empty?
2) How I can use DD statement with IDCAMS?
3) Is IDCAMS the right program?
Thank's!!
Bye