I have file that contains JES2 job output. I'm practicing with DFSORT to retrieve some information from the file on a per-job basis.
One thing I want to achieve is the following:
- first line of job output
- last line of job output
- total lines of job output (per job)
I managed to get the total lines (of the complete output), job number and total lines of the job in my result:
(1) (2) (3)
000001 000001 000001 (1) Total lines
000002 000001 000002 (2) Job number
000003 000001 000003 (3) Lines in job
000004 000001 000004
000005 000001 000005
000006 000001 000006
000007 000001 000007
000008 000001 000008
...
000953 000001 000953
000954 000001 000954
000955 000001 000955
000956 000001 000956
000957 000001 000957
000958 000001 000958
000959 000001 000959
000960 000002 000001 <-- new job output starts here
000961 000002 000002
000962 000002 000003
000963 000002 000004
000964 000002 000005
000965 000002 000006
To achieve the above output, I have used the following SYSIN DD statements (PGM=SORT):
row1:
INREC OVERLAY=(135:SEQNUM,6,ZD,START=1,INCR=1)
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(21,6,CH,EQ,C'J E S 2 '),
PUSH=(142:ID=6), <--- Second row
HIT=NEXT),
IFTHEN=(WHEN=GROUP,
BEGIN=(21,6,CH,EQ,C'J E S 2 '),
PUSH=(149:SEQ=6)) <--- 3th row
The result I want to achieve looks like this:
JOBNAME f_row l_row rowcnt
JOB12345 000001 000100 000099
JOB54321 000101 000500 000399
The issue I currently have is that I don't know how to calculate the rowcnt column. I'm able to calculate the rowcnt column, but I'm only able to do this on the first row of the next job (via SUB).
I think that the best way to do this would be to use an IFTHEN and push the rowcnt to all records in the group, but I haven't got that working in the last 2 days.
At this point I'm stuck. I'm not sure anymore on which statements I should use to accomplish this. Some forums provide a way using 2 separate files, but this is not preferred in my situation. Any guidance into the right direction would be appreciated.