here in the above example 1111 is the header record
2222 till 4444 is the body record
and 5555 is the trailer record where 0003 is the no of the body records.
I just want to count the letter R in the body record (as only one r will be there in each record ) and to compare it with trailer record 0003 whether it is equal or not. If its not equal or if it is zero i want to make it an abended job with error code 16
I have got an idea of doing with copy command but could anyone please get me the control card for this requirement
Thanks in advance
I just want to count the letter R in the body record
R or r?
Is that character always in position 6 or can it be anywhere in the record?
What is the RECFM and LRECL of the input file?
Is the header record always indicated by 1111 in positions 1-4? Is the trailer record always indicated by 5555 in positions 1-4? Or is it actually more complicated than that (e.g. the header record is the first record and nothing in that record indicates it's the header, and the trailer record is the last record and nothing in that record indicates it's the trailer)?
If its not equal or if it is zero i want to make it an abended job with error code 16
An abend and a RC=16 are two different things. Which one do you want?
Thanks for ur consideration
wat i have given as 1111 is the line number so the R is the first letter of the record ( the letter is R. )
The header record contains the date and some other data & the header record is always indicated by the first letter H
The Trailer record contains the number of body record and some other data & the trailer record is always indicated by the first letter H
some times dataset comes only with the header and the trailer record and sometimes there is a mismatch in the record count in the trailer record.
So i need to check the Body record whether there is any record in the dataset starting with letter R and if so the record count matches the trailer records count indicator.
I need to set the RC as 16 if there is no body record i.e no records in dataset starting with letter R.And if the count mismatches.
Thanks in advance
Hi Frank thanks a lot for such a great effort u have taken for me.
I have tried submitting the job with the appropriate input dataset in the sortin and got an error code 16 even though everything looks fine as the count and the body record count is equal i am bit confused with control cards. And can u please tell me why ur using the overlay since overlay is used for formatting purpose and why we are using it here.
And wat the zd in the control card omit Cond implies for .
Wat changes we have to do in case for different record format and for other record length.
Could u please explain me these.
Thanks in advance .
Tony Jose [/quote]
where u have specificied the file format whether it should be fb or vb
You said the input file has RECFM=FB and LRECL=80 so that's what I assumed with:
//SORTIN DD DSN=... input file (FB/80)
OVERLAY=(2:C'0000') could you please tell wat for u have used this
The first step sets up two files as follows:
where n is the count of the R records.
I needed a 0000 constant to check RCOUNT against, so I used the OVERLAY=(2:C'0000') to make sure I had 0000 in positions 2-5 of the trailer record. I could have put it anywhere in the trailer record (except where your count is). I didn't know if your trailer record always had 0000 in positions 2-5 as shown in your example, so I decided not to assume that.
The second step has:
RCOUNT is the count of R records. 2,4,ZD is the 0000 I put in the trailer record so I could check +0 vs RCOUNT.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: