GustlyWind
GustlyWind

Reputation:

How to combining two files and creating a report with matched fields in COBOL

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

Upvotes: 0

Views: 957

Answers (2)

Raja Reddy
Raja Reddy

Reputation: 782

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!

Upvotes: 0

paxdiablo
paxdiablo

Reputation: 881303

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).

Upvotes: 2

Related Questions