Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us