Page 1 of 1

get the current system date through JCL ?

Posted: Tue Mar 12, 2024 8:48 pm
by Neeraj Mehta
Hi,

Any idea on how to get the current system date through JCL ?

Re: get the current system date through JCL ?

Posted: Thu Mar 14, 2024 7:11 pm
by Anuj Dhawan
Try this, using sort:

Code: Select all

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

Re: get the current system date through JCL ?

Posted: Tue Mar 19, 2024 10:53 am
by Neeraj Mehta
Thanks Anuj. This seems to work, is there any other way to do the same?

Re: get the current system date through JCL ?

Posted: Tue Mar 19, 2024 10:25 pm
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-)
 

Re: get the current system date through JCL ?

Posted: Fri Mar 22, 2024 9:48 pm
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.

Re: get the current system date through JCL ?

Posted: Fri Mar 22, 2024 10:03 pm
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


 

Re: get the current system date through JCL ?

Posted: Fri Mar 22, 2024 10:19 pm
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.

Re: get the current system date through JCL ?

Posted: Sat Mar 23, 2024 10:08 pm
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

Re: get the current system date through JCL ?

Posted: Sun Mar 24, 2024 2:54 am
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

Re: get the current system date through JCL ?

Posted: Wed Mar 27, 2024 12:16 pm
by Neeraj Mehta
Thanks for the discussion. What is a symbol convertor?

Re: get the current system date through JCL ?

Posted: Wed Mar 27, 2024 2:15 pm
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).