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

Attach current-date to output file-name ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Tue Nov 23, 2010 11:42 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Nov 23, 2010 11:52 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Nov 23, 2010 11:54 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 24, 2010 12:58 am
Reply with quote

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
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Nov 24, 2010 2:45 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 24, 2010 3:34 am
Reply with quote

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
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Nov 24, 2010 3:49 am
Reply with quote

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
View user's profile Send private message
Subhadeep Manna

New User


Joined: 18 Oct 2010
Posts: 2
Location: India

PostPosted: Wed Nov 24, 2010 2:13 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 24, 2010 10:46 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 25, 2010 12:36 am
Reply with quote

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
View user's profile Send private message
Subhadeep Manna

New User


Joined: 18 Oct 2010
Posts: 2
Location: India

PostPosted: Fri Nov 26, 2010 11:06 am
Reply with quote

Thanks for that... Skolusu and Dick.
I got it.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top