I have an input file which has Header Record, Detail Record and Trailer Record. In my Sort out put file i want the same header and the detail record should have the ATM Transaction only and the Trailer should have the Record Count which is the second field After the Record Type.
My jcl for the above scenario
---------------------------------
input file is like this:
A2008-01-010000000000000000000 =====>header
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p ==========> Detail Record
T00000000000000800000000000000 ===========> Trailer Record
As per my sort steps( mentioned in the jcl in the post) i am getting the proper output.
output file after sort steps
A2008-01-010000000000000000000 =====>header
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A ==========> Detail Record
T000000000000006 ===========> Trailer Record
But i want to Validate the trailer count of the input file before sort first step(wants to do in DFSORT).
For example in the input file the trailer count(which is record Count) is
000000000000008, i want to check this value against the sort count which is done by DFSORT. If it doesn't Match then the job should fail.
Can it be possible through SORT?
TRAILER1=(C'T',COUNT=(M11,LENGTH=15))
M11===> for the next field pls correct me if i am wrong.
if i want to add the trailer where i will update the 4th field which will start at 60th position then how will be the syntax.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
the Trailer should have the Record Count which is the second field After the Record Type.
Quote:
if i want to add the trailer where i will update the 4th field which will start at 60th position then how will be the syntax.
These two statements contradict each other. It isn't clear what you want the TRAILER record to look like. Will the TRAILER record just have 'T' and the count starting at position 60, or will it have other fields as well (other fields from the input TRAILER record, or constants, or what)? Please show clearly what the trailer record looks like in the input file and what you want it to look like in the output file.
Also, what is the RECFM and LRECL of the input file?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I don't understand what you want to validate against what.
Quote:
As per the calculation if the trailer count is not same as the count done in the sort card then it should abend
This doesn't make any sense to me.
If you're using DFSORT to create the output count, then DFSORT will give you the correct count based on what you specified. Why would you need to validate anything?
1.I am getting an input file from the different program of
RECFM=FB,LRECL=1067.
2. i want to validate the trailer of the input file. The trailer of the input file contains the record type and record count. in the input file first position is the record type.
ex:
input file:
------------
A2008-01-010000000000000000000 =====>header 'A' is the type
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p ==========> Detail Record
T00000000000000800000000000000 ===========> Trailer Record
'A' is for Header Rec Type
'D' is the Detail Rec Type
'T' is the Trailer Rec Type
Record Count is the 2nd field after the Rec Type of the Trailer Record.
Here in this case the Record Count is 000000000000008. Record Count field should have the num of Detail Record.
in this case the trailer Record is having the correct value(000000000000008) in the record count field of the trailer.
Let's say we are getting the input file(having same num of Detail Records) which has REcord Count Value as 000000000000009, which is incorrect, should be 000000000000008.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I'm not sure DFSORT would be the best way to do that kind of validation since it would be rather tricky:
You'd have to extract each count, combine them in a single record, and do an INCLUDE for count1,EQ,count2. If they're not equal, you'd get zero records and NULLOUT=RC16 with DEBUG ABEND would get you an ABEND.
Seems like a simple program would be easier to set up and use.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Somebody on another help board posed a similar question but with a better example so I responded to it and I thought I'd post it here in case it will help.
Quote:
Besides writing COBOL program, is it possible to use SORT on a job to validate trailer count on a file and return condition codes depending upon if number of detail records matching trailer count or not.
EXAMPLE 1
INPUT FILE:
Code:
1HDR
2DTLAAAAA
2DTLBBBBB
2DTLCCCCC
9TRL 00000003
Number of 2DTL records = 3, count on 9TRL record = 3
==> counts match and return code = 0
EXAMPLE 2
INPUT FILE:
Code:
1HDR
2DTLAAAAA
2DTLBBBBB
2DTLCCCCC
9TRL 00000004
Number of 2DTL records = 3, count on 9TRL record = 4
==> counts mismatch and return code > 0
You can use a DFSORT job like the following to do what you asked for. Note that you need z/OS DFSORT V1R5 to use NULLOUT (it's not supported in DFSORT R14).