Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
Hi !
I have a data file and a trailer file which has only a trailer record for data file. I need to get the records count from data file and compare it with number of the records in the trailer file. I extracted a number of records from trailer file into a separate file and wanted to add there record count for data file. The JCL is not working. I was thinking when to compare 2 counts in the output file and abend the job if they are different.
Here output.A.TST10 - is the new file I created from trailer file and put the count in the first position. I can't add here the records count from data file - it's giving me the abend.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Aleksandra Sirota,
Use the following DFSORT JCL which will give you the desired results. If the counts don't match step0200 will abend with U0206. Count in the trailer file is assumed to be the first record.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Aleksandra Sirota,
Something doesn't match. You show a layout with picture clause and Data-type of that. The TOTAL_RECORDS has a picture clause of 9(10) which makes it a zoned decimal , but the Data type is INT which makes it a Binary field. Which definition is correct? Similarly for the SUM_FIELD the picture clause is X(18) and the data type is INT . Show me the contents in position 11 thru 20 and also contents in pos 51 thru 68.
Is the Data file a Fixed block file ? Also do you want to validate the count and sum field at the same time? ie. if the both count and sum match the trailer file data , then issue return code of zero or else abend.
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
Skolusu,
I haven't seen the actual data files yet.
I'm building the jobs based on the Excel Spreadsheet layouts provided to me.
This is the definition for the number of records in trailer file:
Total record count for corresponding data file. So I assume the 9(10) is correct and INT is a comment .
This is the description what I have for SUM field in trailer file :
The Sum total of selected fields on the corresponding data file. The picture field varies depending on the number of decimal places stored in the field being summed. Example: a field being summed that is S9(3)V99 results in this field being redefined as a S9(16)V99 using standard COBOL overpunch for sign on a 18-position field.
Also - the data is fixed block and I want to validate them at the same time
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Aleksandra Sirota,
Use the following DFSORT JCL. It will validate the record count and the sum of the packed decimal field at pos 135 for a length of 6 bytes. The record count field is compared to contents at pos 11 for 10 bytes and the sum field is compared to the contents at pos 51 for 18 bytes in the trailer file. If BOTH values match with the trailer file contents the return code is set to zero or else step0200 will abend with U0206.
Look at the SYMNOUT dd sysout and you will see how the symbols are created. Since your sum total can be positive or negative zoned decimal , i created the symbol creating it as a character. For character symbols you need to enclose the value in single quotes and hence the apostrophes
Quote:
Also in this line - INREC OVERLAY=(135:1,5,SFF,PD,LENGTH=6,200:X) what does 5 after 1 means ? And what 200:X means ?
Oops Sorry. My Bad , it is for my testing as I was setting up the test data . You don't need the INREC statement. Just remove it.
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
Hi Skolusu !
Thank you very much. I was able to test the jcl and it's working perfectly fine. The only problem that I'm facing now with it , is that the input file comes with the header record , which I shouldn't use in the record count and sum calculation. Can you please modify the jcl, so it will start the necessary calculations from the second record in the file ? Thanks again
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Aleksandra Sirota wrote:
Hi Skolusu !
Thank you very much. I was able to test the jcl and it's working perfectly fine. The only problem that I'm facing now with it , is that the input file comes with the header record , which I shouldn't use in the record count and sum calculation. Can you please modify the jcl, so it will start the necessary calculations from the second record in the file ? Thanks again
Aleksandra Sirota,
Just add SKIPREC=1 after sort fields=copy in step0100 sysin control cards. This will start calculation values from 2nd record.
In the trailer file the last character of the sum vaue is EBCDIC - col 68.
{ converted to ASCII will be +0 .
Command ===> Scroll ===> PAGE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
07/01/2010000043626500004362650000000000000000000000000625461895616{PR5474B0DELT
******************************** Bottom of Data ********************************
So the SUM compare is not working.
Is it possible to do something about it in the sort ?
In the trailer file the last character of the sum vaue is EBCDIC - col 68.
{ converted to ASCII will be +0 .
So the SUM compare is not working.
Is it possible to do something about it in the sort ?
Aleksandra Sirota,
You need to get your basics right. It is NOT ASCII format. zoned decimal numbers have a sign over punch on the last byte. The over punch in hex format looks like this
Hex C0 thru C9 are positive numbers and D0 thru D9 are negative numbers.
If you are getting a C sign for Zd instead of an F sign, then you're using Syncsort, not DFSORT. DFSORT gives an F sign for TO=ZD. Try using TO=ZDF. And since you're using Syncsort, please post in the JCL Forum, not in the DFSORT Forum.