I want to report on the progress of all the times a process has been
run.  It produces status files with a job ID and a phase number in their
names.  I started out simply enough by sorting on job ID and phase
number, keeping the highest phase number for each job, and then sorting
by date.

But now it turns out a job might be restarted from an earlier phase, and
I'd like information about both the current run and the earlier one.
Sorted by job ID and phase, my list might be like this:

2015-03-16 job1 phase20 <- keep, highest phase for this job
2015-03-15 job1 phase19
2015-03-18 job1 phase12 <- keep, highest phase in later run
2015-03-18 job1 phase11
2015-03-17 job1 phase10
2015-03-18 job2 phase16 <- keep, highest phase for this job
2015-03-18 job2 phase15

Then I can use SPECS IF to compare job ID and date between consecutive
records, and keep the record if the job has changed or the date has
increased:

  ... | literal
      | specs nowrite 1-* 1 a: w2 . b: w3 .
          select second     c: w2 . d: w3 .
          if (a ¬== c || b >> d) then write endif
      | ...

(The LITERAL is needed to fill in the second reading station for the
first record.  If I care about the possibility of a first record with
missing info, it gets more complicated.)

I can't help wondering if I'm overlooking some less cryptic approach.
It might be even nicer if the file didn't have to be sorted by job
first, so I could sort just once by date, job, and phase, but I'm not
seeing a way to keep track of phases for multiple jobs without REXX.

¬R

(Actually, though, in the current application, sorting by date afterward
is more convenient anyway because of other processing I
do along with checking the date.  Did I mention this is on MVS?)

Reply via email to