如何在 COBOL 中合并两个文件并创建具有匹配字段的报告

发布于 2024-07-17 12:44:37 字数 666 浏览 10 评论 0原文

我有两个文件: 第一个文件包含作业名称和开始时间,如下所示:

ZPUDA13V STARTED - TIME=00.13.30
ZPUDM00V STARTED - TIME=03.26.54
ZPUDM01V STARTED - TIME=03.26.54
ZPUDM02V STARTED - TIME=03.26.54
ZPUDM03V STARTED - TIME=03.26.56

第二个文件包含作业名称和结束时间,如下所示:

ZPUDA13V ENDED - TIME=00.13.37
ZPUDM00V ENDED - TIME=03.27.38
ZPUDM01V ENDED - TIME=03.27.34
ZPUDM02V ENDED - TIME=03.27.29
ZPUDM03V ENDED - TIME=03.27.27

现在我尝试组合这两个文件来获取像 JOBNAME START TIME ENDTIME 这样的报告。我已经使用 ICETOOL 来获取报告如果我得到 JOBNAME START TIME,ENDTIME 是空格。如果我得到 Endtime,JOBNAME START TIME 会得到空格。 请让我知道如何对 outrec 字段进行编码,因为我已经用几乎所有可能性进行了编码以获得所需的字段。但我的输出仍然与我需要的不一样

I have two files :
first file contains jobname and start time which looks like below:

ZPUDA13V STARTED - TIME=00.13.30
ZPUDM00V STARTED - TIME=03.26.54
ZPUDM01V STARTED - TIME=03.26.54
ZPUDM02V STARTED - TIME=03.26.54
ZPUDM03V STARTED - TIME=03.26.56

and the second file contains jobname and Endtime which looks like below:

ZPUDA13V ENDED - TIME=00.13.37
ZPUDM00V ENDED - TIME=03.27.38
ZPUDM01V ENDED - TIME=03.27.34
ZPUDM02V ENDED - TIME=03.27.29
ZPUDM03V ENDED - TIME=03.27.27

Now I am trying to combine these two files to get the report like JOBNAME START TIME ENDTIME.I have used ICETOOL to get the report If I get JOBNAME START TIME ,ENDTIME is SPACES .If I get Endtime ,JOBNAME START TIME gets spaces.
Please let me know how to code the outrec fields as I have coded with almost all possibilites to get the desired one.But still my output is not the same as I required

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉城凉梦凉人心 2024-07-24 12:44:37

我不知道 ICETOOL 是什么(甚至也不想在 Google 中查找它:-),但这是一个经典的 COBOL 数据处理任务。

根据您的简单数据输入,该算法将是:

for every record S in startfile:
    for every record E in endfile:
        if S.jobnname = E.jobname:
            ouput S.jobname S.time E.time
            next S
        endif
    endfor
endfor

但是,您可能需要考虑以下事实:

  • 一天中可能会运行多个同名作业(文件中的多个条目)。
  • 多个同名作业可以同时运行。

您可以通过确保 E 记录是紧随 S 记录之后的记录(基于时间)来解决第一个问题。 第二个问题很棘手。

如果您在 z/OS 上运行(考虑到作业名称,您可能是在 z/OS 上运行),您是否考虑过使用 SMF 记录中的信息来进行此收集和分析。 我非常确定 SMF 30 型唱片可以容纳您需要的一切。

假设这是一个大型机问题,这里有一个我工作中的朋友写的一本书的无耻插件,请查看大型机到底是什么? 作者:David Stephens (ISBN-13 = 978-1409225355)。

I have no idea what ICETOOL is (nor the inclination to even look it up in Google :-) but this is a classic COBOL data processing task.

Based on your simple data input, the algorithm would be:

for every record S in startfile:
    for every record E in endfile:
        if S.jobnname = E.jobname:
            ouput S.jobname S.time E.time
            next S
        endif
    endfor
endfor

However, you may need to take into account the fact that:

  • multiple jobs of the same name may run during the day (multiple entries in the file).
  • multiple jobs of the same name may run at the same time.

You could get around the first problem by ensuring the E record was the one immediately following the S record (based on time). The second problem is a doozy.

If you're running on z/OS (and you probably are, given the job names), have you considered using information from the SMF records to do this collection and analysis. I'm pretty certain SMF type 30 records hold everything you need.

And assuming this is a mainframe question, here's a shameless plug for a book one of my friends at work has written, check out What On Earth is a Mainframe? by David Stephens (ISBN-13 = 978-1409225355).

娇纵 2024-07-24 12:44:37

我知道,我的解决方案太晚了,但可能对 stackoverflow 的新手有帮助。

您可以使用 JCL 来利用 DFSORTJOINKEYS

JOINKEYS F1 FIELDS=(01,08,CH,A)
JOINKEYS F2 FIELDS=(01,08,CH,A)
REFORMAT FIELDS=(F1:01,33,F2:25,08)
SORT FIELDS=COPY
OUTREC FIELDS=(01,08,25,08,34,08)

outrec 将根据您的需要保存数据!

I know, i'm toooo late with my resolution, but may be helpful for new comers to stackoverflow

You can make use of JOINKEYS of DFSORT using JCL.

JOINKEYS F1 FIELDS=(01,08,CH,A)
JOINKEYS F2 FIELDS=(01,08,CH,A)
REFORMAT FIELDS=(F1:01,33,F2:25,08)
SORT FIELDS=COPY
OUTREC FIELDS=(01,08,25,08,34,08)

the outrec will hold the data as you need!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文