File has three types of records (record type 1 ,2 & 9) and first character is used to identify the record type. Record type 1 has an amount which starts from position 20 and length is 13 bytes.
Record type 9 contains the count of record type 1 (starts from position 2 and takes 7 bytes), count of record type 2 (starts from position 9 and takes 7 bytes) and the sum total of amount field for record type 1.
Is there any way we can validate the input file i.e. the count of record type 1 and total of record type with info present in record type 9 of the file? If yes then please can you provide the sample sort JCL to achieve this?
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
What happens to this dataset after validation? Does it go into another program? If so, then that program needs to do the validation. If the file is not processed further but sent elsewhere then it should have headers and trailers (it should have these anyway) so that the remote program can validate it.
Is there any way we can validate the input file i.e. the count of record type 1 and total of record type with info present in record type 9 of the file?
What is the position in record type 9 which gives the count of type 1? Please give us a sample example which explains the need clearly.
The example is given in my post. The count starts from position 2 and length of counter field is 7 bytes. If you refer to the sample data u will notice the count value as 10 starting from 2nd byte. Let me know if it is still not clear.
Nic, the file will be going to another program but I want to do generic validation first before we process the file and that validation is to cross check the count of record type 1 with the values present in record type 9.
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
Well, that validation (which is specific, not generic) is a task of the program that reads the data and is one of the tasks of every program - validate the input as necessary. That task should not be 'out-sourced'. Anything could happen between the sort validating it and the program reading it.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Varun Sethi wrote:
Nic, the file will be going to another program but I want to do generic validation first before we process the file and that validation is to cross check the count of record type 1 with the values present in record type 9.
It can be validated and what do you need to do if they match and what do you need to do if they don't match? Set a return code?
Thanks a lot it works and sorted my requirement. One more thing i can see if we the total and count matches then the outfile will contain the record detailng the count for each types.
If they don't match then we are abending. Is it possible to write a message in the outfile if the total's doesn't match?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Look up NULLOFL in the manual, and then re-assess your question.
You should understand everything abou tthe solution before asking questions. You're going to paste it as your solution, so you'd better know how to answer questions on it, which means you understanding it all first.
Could you repeat the condition on another OUTFIL and get a message there? Have a go. You have some sample code, the manuals, examples in the manuals, examples you can search for on the internet.
Please accept my sincere apologies. I did understood the solution completely and gave a try to NULLOFL but it was not working for me. Anyways will try the other options.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Varun Sethi wrote:
Thanks a lot it works and sorted my requirement. One more thing i can see if we the total and count matches then the outfile will contain the record detailng the count for each types.
If they don't match then we are abending. Is it possible to write a message in the outfile if the total's doesn't match?
Varun Sethi,
I specifically asked you what needs to be done if the totals don't match and your response was
Varun Sethi wrote:
if the count and the total doesn't match then i would like to set the return code or abend.
And now you want it differently? When you have abend, what would you do with the message? If you need help then please do us a favor to spell out the complete requirement rather than bits and pieces or you should be capable enough to make the changes for your self.
Varun Sethi wrote:
I did understood the solution completely and gave a try to NULLOFL but it was not working for me. Anyways will try the other options.
This kind of response isn't going to help you anyway. When you say something that doesn't work you need to provide us what you did and explain why it doesn't work as none of us can read your mind nor look over your shoulder.