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
Tony
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
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)?
Quote:
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
Tony jose
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 to use NULLOUT=RC16. If you have DFSORT R14, you can set up the job to use ICETOOL COUNT instead of NULLOUT=RC16.
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]
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Too many questions at once.
Let's start with your statement that you got an error code 16 when you thought you shouldn't (at least I think that's what you're saying).
You need to show me an example of the input records that produce the RC=16 you don't expect, and the //SYSOUT messages from step S1 and step S2 in that case.
Hi frank thanks a lot now its working fine. Really a good one But i have some doubts regarding the control cards you have given
OVERLAY=(2:C'0000') could you please tell wat for u have used this and where u have specificied the file format whether it should be fb or vb or fbe .
could you please tell me this.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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)
Quote:
OVERLAY=(2:C'0000') could you please tell wat for u have used this
The first step sets up two files as follows:
SYM has:
RCOUNT,+n
where n is the count of the R records.
TRL has:
T0000000003000000000000000000
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:
Code:
OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,8,4,ZD,NE,RCOUNT)
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.
hi Frank thanks once again and
one more thing can i add or minus value to the count to meet some requirment
In case my value in the trailer is showing 0005 as adding the header and the trailer record and so i need to add the count value plus 2 so that our count value now equals the trailer count value
will this do
Quote:
TRAILER1=('RCOUNT,+',COUNT+2=(M11,LENGTH=4))
(tried but not yet got)
If not how can i add value to the rcount
And wats this m11 denotes in this code
INCLUDE=(1,1,CH,EQ,C'R') gives you the count of just the R records. Without it, you'll get the count of all of the records.
Does that mean you want check for RCOUNT=2 instead of RCOUNT=0 for the no R records case? If so, you can change OVERLAY=(2:C'0000') to OVERLAY=(2:C'0002').
Quote:
And whats this m11 denotes in this code
M11 is one of DFSORT's 27 edit masks. M11 gives a numeric output value with leading zeros. See:
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: