View previous topic :: View next topic
|
Author |
Message |
Vikash Arjun
New User
Joined: 21 Jul 2022 Posts: 3 Location: Banglore, India
|
|
|
|
We have a output file and it already has header and trailer in it. So, we need a JCL to check whether the header date and trailer count in correct. If the count mismatches the job should fail. Which utility can be used or any sample JCL would be fine. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
JCL cannot help you, but almost any other tool can.
You have placed you topic under DFSORT section. Are you familiar with SORT? Is yes, you can try:
1) split your data into two intermediate temporary datasets: the numbered headers, and the numbered trailers.
2) join those two datasets on their record numbers, and verify or compare any desired field(s) in every paired record.
Remains completely unclear, what to consider as "correct date", and "correct count"????
The title is "Comparing headers and trailers". Does this mean, all your headers must be equal to your trailers???
I guess the correct approach should be: to ignore all existing headers and trailers, and to generate new correct ones.
This forum doesn't provide a ready solution from scratch, unless the author has demonstrated his own efforts to solve his own problem.
BTW, it is a very doubtful requirement: "the job should fail"...
Would it really help if the only result of you job was like this?
...... TESTJOB FAILED ABEND S000 U1234 ...... |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Basically the output dataset should be created the right way. Why is it possible that Header/Trailer are incorrect? Second, I agree what has been written, generating correct Header/Trailer records makes more sense. |
|
Back to top |
|
|
Vikash Arjun
New User
Joined: 21 Jul 2022 Posts: 3 Location: Banglore, India
|
|
|
|
Thank You Joerg.Findeisen,
I would say the file is created by UNIX and I am trying to PULL the file from UNIX to Mainframe. So, if the header and trailer count is not correct or if there is a mismatch on the file, we need a COND where the job should fail. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
I need to repeat again: no matter where your "file" has come from.
If only you suspect it has wrong information in it, it makes no sense to just indicate it, and to start a long process on forcing other people to re-create the correct output for you to use it.
The better and faster approach should be: to ignore all existing (maybe wrong) headers and trailers, and to generate new correct ones.
Anyway: in order to verify the "correctness" of existing headers and trailers, you NEED to create the correct ones! If so, why no to immediately replace the potentially wrong information with the proven correct one? |
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
What @sergeyken said is IMHO the best way, discard HDR/TRL records and create valid ones. There is no need to flush anything then because the data is valid. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
When headers/totals of the transferred file are incorrect, it MUST be fixed by the creator of this wrong data.
If not fixed, then dismissal, or death penalty may be the good action for him. |
|
Back to top |
|
|
|