View previous topic :: View next topic
Author
Message
Sysaron New User Joined: 28 Sep 2005Posts: 55 Location: USA
Hello there,
I did scan the questions and could not find the answer.
Is it possible for DFSORT or ICETOOL to make a copy of a file and attach the current date as the last name in the file. Such as this:
Input: my.file.data
Output: my.file.data.20101123 <---- today's date yyymmdd
Thank you so much in advance.
Sharon in L.A.
Back to top
Craq Giegerich Senior Member Joined: 19 May 2007Posts: 1512 Location: Virginia, USA
Sysaron wrote:
Hello there,
I did scan the questions and could not find the answer.
Is it possible for DFSORT or ICETOOL to make a copy of a file and attach the current date as the last name in the file. Such as this:
Input: my.file.data
Output: my.file.data.20101123 <---- today's date yyymmdd
Thank you so much in advance.
Sharon in L.A.
Your output file name would not be a valid MVS file name.
Back to top
Akatsukami Global Moderator Joined: 03 Oct 2009Posts: 1788 Location: Bloomington, IL
The name you give as an example would be an invalid DSN. Moreover, I hardly think that DFSORT would be the tool of choice for setting the DSN (although I will defer to Messrs. Yaeger and Kolusu on this). I would recommend creating IDCAMS control cards (that could be done by DFSORT) or modifying the JCL with a bit of Rexx prior to submission.
The consensus in these fora seems to be that the inclusion of the creation date of a data set in its name is at best a dubious practice; you may wish to contemplate whether a GDG might be used instead.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
And the question is not really related to SORT. . .
Once you have decided on what to use as a valid dataset name, there are multiple topics in the forum about generating a dataset name/node rather than having it hardcoded.
Back to top
Sysaron New User Joined: 28 Sep 2005Posts: 55 Location: USA
Hi there,
I will give a valid name:
SYSHR.D112310.DATA
----- .Dmmddyy.------
I hope someone can help. The customers rejected using GDGs.
Thanks so much.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
sysaron,
The following DFSORT JCL will give you the desired results. Once you have verified the jcl created is good, change the statement
Code:
//SORTOUT DD SYSOUT=*
to
Code:
//SORTOUT DD SYSOUT=(*,INTRDR)
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DUMMY RECORD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(DATE1)
OUTFIL OUTREC=(C'//USERIDZ JOB ',X'7D',C'CREATE DSN',X'7D',
C',CLASS=A,',/,
C'//',13X,C'MSGCLASS=Y,MSGLEVEL=(1,1),',/,
C'//',13X,C'NOTIFY=&SYSUID',/,
C'//*',/,
C'//STEP0100 EXEC PGM=IEFBR14',/,
C'//FILE1 DD DSN=SYSHR.D',5,4,3,2,C'.DATA,',/,
C'// DISP=(NEW,CATLG,DELETE),',/,
C'// UNIT=SYSDA,',/,
C'// SPACE=(CYL,(X,Y),RLSE),',/,
C'// DCB=(LRECL=NNN,RECFM=FB,BLKSIZE=0)',/,
C'//*',80:X)
//*
This will create a JCL which looks like this
Code:
//USERIDZ JOB 'CREATE DSN',CLASS=A,
// MSGCLASS=Y,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//STEP0100 EXEC PGM=IEFBR14
//FILE1 DD DSN=SYSHR.D112310.DATA,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE),
// DCB=(LRECL=NNN,RECFM=FB,BLKSIZE=0)
//*
Alternatively you can generate the same using EZACFSM1
Back to top
Sysaron New User Joined: 28 Sep 2005Posts: 55 Location: USA
Thank you so much Skolusu !!!
That is a very cool and easy way to create JCL.
Your time and expertise is Much Appreciated.
Back to top
Subhadeep Manna New User Joined: 18 Oct 2010Posts: 2 Location: India
Hi Skolusu
Please explain how the following statement works to provide the current date identifier
C'//FILE1 DD DSN=SYSHR.D',5,4,3,2,C'.DATA,',/,
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Subhadeep Manna wrote:
Hi Skolusu
Please explain how the following statement works to provide the current date identifier
C'//FILE1 DD DSN=SYSHR.D',5,4,3,2,C'.DATA,',/,
Subhadeep Manna,
The INREC statement creates 1 record with current date using DATE1 keyword in CCYYMMDD format.
Code:
----+----1----+
20101124
The OUTREC statement is just picking the MM DD YY values from the output generated from INREC.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello and welcome to the forum,
Quote:
Please explain how the following statement works to provide the current date identifier
C'//FILE1 DD DSN=SYSHR.D',5,4,3,2,C'.DATA,',/,
As Skolusu explained - this reformats the date.
This obtains the date:
Code:
INREC FIELDS=(DATE1)
Back to top
Subhadeep Manna New User Joined: 18 Oct 2010Posts: 2 Location: India
Thanks for that... Skolusu and Dick.
I got it.
Back to top
Please enable JavaScript!