IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Allocate dataset with date and time


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 202
Location: Toronto, ON, Canada

PostPosted: Thu Aug 06, 2015 9:48 pm
Reply with quote

Below is sample JCL using SORT and IDCAMS to allocate a dataset with the date and time as last qualifiers of the name (example 'MY.PDS.D151231.T235959').
Code:
//*
//* GENERATE IDCAMS STATEMENT TO ALLOCATE A DATASET
//* WITH DATE 'DYYMMDD' AND TIME 'THHMMSS' IN THE NAME.
//* - SPECIFY DATASET PREFIX ON PARM
//* - SPECIFY DATASET ATTRIBUTE UNDER DD=SORTIN
//*
//SORT     EXEC PGM=SORT,PARM='JP0"MY.PDS"'
//SYSOUT    DD SYSOUT=*
//SYMNOUT   DD SYSOUT=*
//SORTIN    DD *
   NEW CATALOG TRACKS SPACE(10,10) +
   DSNTYPE(LIBRARY) DSORG(PO) RECFM(F B) LRECL(80) DIR(1)
//SORTOUT   DD DSN=&&IDCAMS,
//  DISP=(NEW,PASS),SPACE=(TRK,(1,1)),
//  DSORG=PS,RECFM=FB,LRECL=80
//SYSIN     DD *
 OPTION COPY
 OUTFIL FNAMES=SORTOUT,REMOVECC,
   HEADER1=(C' ALLOCATE DSN(''',JP0,
            C'.D',DATENS=(YMD),C'.T',TIMENS=(24),
            C''') +')
//*
//* EXECUTE
//*
//IDCAMS  EXEC PGM=IDCAMS,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DSN=&&IDCAMS,DISP=(OLD,DELETE)

REXX is better method but the above works too. Comments or suggestions are welcome.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top