Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Allocate dataset with date and time

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jerryte

Active User


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

PostPosted: Thu Aug 06, 2015 9:48 pm    Post subject: Allocate dataset with date and time
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts Browse dataset cvnlynn CLIST & REXX 4 Tue Jul 18, 2017 3:52 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us