How do I put a date onto the file name?

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

How do I put a date onto the file name?

Post by dbdinc » Mon Aug 17, 2009 9:32 pm

In my JCL, when I am creating an output file, I need to use the system date as part of the output file name, so that the file name looks something like this:

MY.FILE.082309

How do I take the system date and make it part of my output file name?

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Mon Aug 17, 2009 11:21 pm

First of all, that's an invalid dataset name.

Second, don't forget that JCL is not a programming language. Stuff like date and time are completely foreign to it.

Third, where's the job going to get the date value from? A program? A JCL SET statement? A scheduler variable? Does the value for the date need to be referred to in multiple locations throughout the job?

Personally, I recommend creating and cataloging the dataset with a date or time value from within a program.

dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

Post by dbdinc » Tue Aug 18, 2009 1:59 am

Well....,

I was able to create a data set with a name of output.file.090817.142339, so I don't see how the example I mentioned in my original post was an invalid dataset name. Second, the date was extracted from the mainframe's date and time internals, so stuff like date and time are not completely foreign to it.. Thirdly, the same comment applies - the date and time were extracted from mainframe internals. No language use was involved, except in creating the data contained in my date and time stamped data file.

I suggest you might try doing an Internet search concerning adding a date or time to the name of a mainframe output dataset.

Gerry Ciccheti
Member
Posts: 16
Joined: Thu Jul 30, 2009 7:52 am

Post by Gerry Ciccheti » Tue Aug 18, 2009 7:33 am

Hi,

You cannot allocate a dataset on the mainframe as "output.file.090817.142339"


Gerry

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Aug 18, 2009 1:55 pm

I was able to create a data set with a name of output.file.090817.142339
Are you talking about Mainframes? On Mainframes, each qualifier, in a DSN, must be 1-8 alphanumeric characters, the first alphabetic. Period.
Regards,
Anuj

dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

Post by dbdinc » Tue Aug 18, 2009 7:28 pm

True and I stand corrected. I had prefaced my date with the letter "D" and my time with the letter "T". I got ahead of myself in my earlier response.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Aug 18, 2009 8:30 pm

I stand corrected.
How?

This
I was able to create a data set with a name of output.file.090817.142339
as stated couple of times, is not possible on IBM mainframes.
Regards,
Anuj

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Tue Aug 18, 2009 8:31 pm

Well then, getting back to the original topic. What method will you use to provide the values for date and/or time to the job? Or are you going to do this from inside a program instead?

dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

Post by dbdinc » Tue Aug 18, 2009 9:01 pm

How? By virtue of your response.

The file name issue has already been addressed and does not need to be repeated any more.

dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

Post by dbdinc » Tue Aug 18, 2009 9:05 pm

MrSpock wrote:Well then, getting back to the original topic. What method will you use to provide the values for date and/or time to the job? Or are you going to do this from inside a program instead?
I will use the method of using system values placed into my JCL. Look at the informaiton in this link:

[color=red]***deleted by admin******[/ ... 7874.html

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

Post by Krishna » Tue Aug 18, 2009 9:27 pm

Hi dbdinc,

Links to other forums are not allowed here.
If you already got the answer .. post the results/answer here.


Thanks.
Admin,
www.mainframegurukul.com

dbdinc
Member
Posts: 17
Joined: Mon Aug 03, 2009 8:29 pm

Post by dbdinc » Wed Aug 19, 2009 12:02 am

Krishna wrote:Hi dbdinc,

Links to other forums are not allowed here.
If you already got the answer .. post the results/answer here.


Thanks.
Admin,
www.mainframegurukul.com
I wasn't aware of that; it's unfortunate, because sometimes the answer to a question might be in another forum but not in this forum. I am not belittling this forum - I just thought that the Internet was a place for knowledge sharing, not knowledge limiting.

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

Post by Krishna » Wed Aug 19, 2009 10:24 am

We understand your point.
In this board you can share the knowledge. But not the links to other competitive discussion boards.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others