0

How do I add the current date/time to a file in JCL?

For example, from the JCL:

//INPUT DD *
CGQ-TEST.ISQCQ.NET
ASCII
LOCSITE SBD=SYSP.FTP.RCAMSI
SENDSITE
PUT    'TJ.UTJ0IR86.BC814.HDR'  BC814001.TMP
APPEND 'TJ.UTJ4IR86.BC(0)'      BC814001.TMP
APPEND 'TJ.UTJ0IR86.BC814.TRL'  BC814001.TMP
RENAME BC813001.TMP BC814001.TXT
CLOSE
QUIT

I need the file BC814001.TXT to actually be BC814001.20160930.110900.ent, where 20160930.110900 is current date and time (YYYYMMDD.HHMMSS format).

Ardia
  • 89
  • 2
  • 10

2 Answers2

0

The best way to do this is to use the features of your job scheduling package (Control-M or one of its competitors). It's usually the most maintainable. Talk to your production control staff.

If for some reason that won't work for you, please see this answer.

Community
  • 1
  • 1
cschneid
  • 10,237
  • 1
  • 28
  • 39
0

The convention fd dataset level qualifiers limits you only to 8 characters per section (space between dots) and it should start with a character not a number.

Each name segment (qualifier) is 1 to 8 characters, the first of which must be alphabetic (A to Z) or national (# @ $). The remaining seven characters are either alphabetic, numeric (0 - 9), national, a hyphen (-). Name segments are separated by a period (.).

For z/OS environments I would go with 'day of the year' for the actual date. For example in your case - BC814001.D2016274.T110900.ent.

To get the current date and time You can refer to the TSO DATE and TSO TIME via REXX and format them the way You like (examples here http://www.rexxla.org/rexxlang/mfc/datec.html) then pass them as a variable to your SYSIN statement.

Regards, Jarek.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jarek Brocki
  • 129
  • 1
  • 9