我们如何使用JCL在PS文件名限定符中获取当前日期? [英] How do we get the current date in a PS file name qualifier using JCL?

查看:204
本文介绍了我们如何使用JCL在PS文件名限定符中获取当前日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用JCL在PS文件名限定符中获取当前日期?

How do we get the current date in a PS file name qualifier using JCL?

示例输出文件名:Z000417.BCV.TEST.D120713(YYMMDD格式).

Example out put file name: Z000417.BCV.TEST.D120713 (YYMMDD format).

推荐答案

可以做到这一点,但不一定要简单明了.直接的方式是使用系统符号.不幸的是这仅适用于批处理如果已在最新版本的z/OS中为作业类启用了作业,则该作业将被启用.

This can be done, but not necessarily in a straightforward manner. The straightforward manner would be to use a system symbol in your JCL. Unfortunately this only works for batch jobs if it has been enabled for the job class on more recent versions of z/OS.

在z/OS v2之前,IBM指出此方法不起作用的原因是,您的作业可以在伦敦的计算机上提交,JCL可以在悉尼的计算机上解释,并且该作业实际上可以在Windows上执行.在芝加哥的机器.数据集上应该是哪个日期(或时间)?没有一个正确的答案,因此我们都针对该问题创建了我们自己的解决方案,其中包含了我们认为对组织正确的答案.

Prior to z/OS v2, IBM's stated reason this didn't work is that your job could be submitted on a machine in London, the JCL could be interpreted on a machine in Sydney, and the job could actually execute on a machine in Chicago. Which date (or time) should be on the dataset? There is no one correct answer, and so we all created our own solutions to the problem that incorporates the answer we believe to be correct for our organization.

如果您能够在批处理作业JCL中使用系统符号,则有

If you are able to use system symbols in your batch job JCL, there is a list of valid symbols available to you.

实现目标的一种方法是使用作业计划工具.我熟悉Control-M,它使用了所谓的自动编辑变量".这些是产品提供的特殊结构. Control-M解决方案是将您的数据集名称编码为 Z000417.BCV.TEST.D%ODATE.

One way to accomplish your goal is to use a job scheduling tool. I am familiar with Control-M, which uses what are called "auto-edit variables." These are special constructs that the product provides. The Control-M solution would be to code your dataset name as Z000417.BCV.TEST.D%%ODATE.

某些商店实施了计划的作业,该作业在共享的PDS中创建一个成员.该成员由标准JCL SET语句列表组成.

Some shops implement a scheduled job that creates a member in a shared PDS. The member consists of a list of standard JCL SET statements...

// SET YYMMDD=120713
// SET CCYYMMDD=20120713
// SET MMDDYY=071312

...等等.该成员是每天一次在午夜通过为此目的安排的工作创建的.作业执行在该商店中编写的程序来创建这些SET语句.

...and so on. This member is created once a day, at midnight, by a job scheduled for that purpose. The job executes a program written in that shop to create these SET statements.

另一个答案是您可以使用

Another answer is you could use ISPF file tailoring in batch to accomplish your goal. This would work because the date would be set in the JCL before the job was submitted. While this will work, I don't recommend it unless you're already familiar with file tailoring and executing ISPF in batch in your shop. I think it's kind of complicated for something this simple to accomplish in other ways outlined in this reply.

您可以使用GDG代替名称中带有日期的数据集.如果您要查找的是一个唯一的名称,那么GDG就是这样做的(除其他事项外).

You could use a GDG instead of a dataset with a date in its name. If what you're looking for is a unique name, that's what GDGs accomplish (among other things).

我想到的最后一个想法是使用不包含日期的名称创建数据集,然后使用

The last idea that comes to my mind is to create your dataset with a name not containing the date, then use a Unix System Services script to construct an ALTER command (specifying the NEWNAME parameter) for IDCAMS, then execute IDCAMS to rename your dataset.

这篇关于我们如何使用JCL在PS文件名限定符中获取当前日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆