get the current system date through JCL ?

JES2/3, JCL, utilities.
Post Reply
Neeraj Mehta
Registered Member
Posts: 16
Joined: Sat Oct 04, 2014 9:36 am
India

get the current system date through JCL ?

Post by Neeraj Mehta »

Hi,

Any idea on how to get the current system date through JCL ?
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: get the current system date through JCL ?

Post by Anuj Dhawan »

Try this, using sort:

Code: Select all

//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(5:&DATE1,13:&TIME2)
/*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Neeraj Mehta
Registered Member
Posts: 16
Joined: Sat Oct 04, 2014 9:36 am
India

Re: get the current system date through JCL ?

Post by Neeraj Mehta »

Thanks Anuj. This seems to work, is there any other way to do the same?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: get the current system date through JCL ?

Post by enrico-sorichetti »

is there any other way to do the same?

why ask if the suggested method works ?
if You are not satisfied with the answer you received a paid consultant will be happy to work with you until you get the answer you like
8-)
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Neeraj Mehta
Registered Member
Posts: 16
Joined: Sat Oct 04, 2014 9:36 am
India

Re: get the current system date through JCL ?

Post by Neeraj Mehta »

Thanks enrico for the comment.

I have told that we can do it without sort also, and there is a requirement to do it with out sort, so I've asked. I was not aware about it before.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: get the current system date through JCL ?

Post by enrico-sorichetti »

and there is a requirement to do it with out sort, I was not aware about it before.
then learn  to collect all the requirement before asking  for a solution

the sort solution is the simplest available


 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
zum13
Registered Member
Posts: 84
Joined: Thu May 04, 2023 12:58 am

Re: get the current system date through JCL ?

Post by zum13 »

Hello.

There are a number of system symbols that are available for use in JCL which are documented here: https://www.ibm.com/docs/en/zos/3.1.0?t ... mic-system

The bulk of these symbols relate to dates and times. If you don't want the complete date/time formats provided, there are enough symbols available for you to roll your own date/time format.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: get the current system date through JCL ?

Post by Anuj Dhawan »

You can try using symbol converter EZACFSM1, as zum13 has indicated. One example is here of using symbol converter: viewtopic.php?p=3998#p3998
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
zum13
Registered Member
Posts: 84
Joined: Thu May 04, 2023 12:58 am

Re: get the current system date through JCL ?

Post by zum13 »

The symbol converter isn't actually necessary. Since version 2, symbols can be put into in-stream data providing JES2 is told to resolve them via the "SYMBOLS" parameter. For example, the following will copy the date and time symbols to sysout:

Code: Select all

//STEP2   EXEC PGM=ICEGENER
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD DUMMY
//SYSUT1    DD *,SYMBOLS=EXECSYS
&YYMMDD &HHMMSS
//SYSUT2    DD SYSOUT=*
This can be done with user-defined symbols as well, but some use of the "EXPORT" statement would be required.

The facility to use symbols in JCL statements has been around for rather longer so putting them into program parameters or something like a dataset name will work without the need for an additional program to be involved, for instance:

Code: Select all

//STEP1   EXEC PGM=PROG1,PARM='&YYMMDD'
//INPUT     DD DSN=&SYSUID..D&YYMMDD,DISP=SHR
Neeraj Mehta
Registered Member
Posts: 16
Joined: Sat Oct 04, 2014 9:36 am
India

Re: get the current system date through JCL ?

Post by Neeraj Mehta »

Thanks for the discussion. What is a symbol convertor?
User avatar
zum13
Registered Member
Posts: 84
Joined: Thu May 04, 2023 12:58 am

Re: get the current system date through JCL ?

Post by zum13 »

Prior to version 2, JES2 could not be told to substitute symbols into in-stream data so if you did

Code: Select all

//SYSUT1    DD *
&YYMMDD &HHMMSS
then the string "&YYMMDD &HHMMSS" is what would appear in the SYSUT1 input.

In order to get around this limitation for TCP/IP, a program called "EZACFSM1" was created which looks for the symbols in the input and does the substitutions. This is the symbol converter (it's actually referred to in the documentation as the "symbol translator utility": https://www.ibm.com/docs/en/zos/3.1.0?t ... em-symbols).
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”