View previous topic :: View next topic
|
Author |
Message |
Aleksandra Sirota
New User
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.
This is my JCL :
Code: |
//STEP010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//*
//IN DD DSN=INPUT.DLY.A.TST1,DISP=SHR
//SORTOUT DD DSN=output.A.TST10,DISP=SHR
//*
//*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=SORTOUT,BUILD=(1,10,11:COUNT=(M11,LENGTH=10)) |
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.
Thanks a lot for the help |
|
Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Aleksandra Sirota,
What is the format of the count in the trailer file? Show me a sample of the trailer file along with the LRECL and recfm of the trailer file. |
|
Back to top |
|
 |
Aleksandra Sirota
New User
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
|
|
|
|
Hi Kolusu,
This is the trailer file format :
Code: |
Field Level / Name PICTURE FLD START END LENGTH DATA TYPE
10 DATE X(10) 1 1 10 10 DATE
10 TOTAL_RECORDS 9(10) 2 11 20 10 INT
10 TOTAL_ADDS 9(10) 3 21 30 10 INT
10 TOTAL_DELETES 9(10) 4 31 40 10 INT
10 TOTAL_CHANGES 9(10) 5 41 50 10 INT
10 SUM_FIELD X(18) 6 51 68 18 INT
10 INTERNAL X(80) 7 69 148 80 CHAR
|
I need to compare total_records from here with the number of records in a file.
Edited, don't use tabs! |
|
Back to top |
|
 |
Skolusu
Senior Member
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.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input data file,DISP=SHR
//SORTOUT DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
TRAILER1=('DATA_COUNT,+',COUNT=(M11,LENGTH=10))
//*
//STEP0200 EXEC PGM=SORT,PARM='RC16=ABE'
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S,DISP=SHR
//SORTIN DD DSN=Your input 148 byte trailer file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,NULLOUT=RC16,STOPAFT=1
INCLUDE COND=(11,10,BI,EQ,DATA_COUNT)
//* |
|
|
Back to top |
|
 |
Aleksandra Sirota
New User
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
|
|
|
|
Hi Skolusu !
Thanks a lot. I'll test it and let you know about the results.
One more question. Can you please give me the version of jcl , where instead of number of records - I can validate the total sum ?
In the trailer it's called SUM_FIELD.
This is it's location in the file:
Code: |
Field Level / Name PICTURE FLD START END LENGTH DATA TYPE
10 DETAILED_AMT S9(9)V99[COMP-3] 135 140 6 DECIMAL
|
Edited again, what part of "Edited, don't use tabs!" did you not understand?
See Suggestion Whenever indentation representation needed. |
|
Back to top |
|
 |
Skolusu
Senior Member
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. |
|
Back to top |
|
 |
Aleksandra Sirota
New User
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 |
|
Back to top |
|
 |
Skolusu
Senior Member
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.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input data file,DISP=SHR
//SORTOUT DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
TRAILER1=('REC_COUNT,+',COUNT=(M11,LENGTH=10),/,
'SUM_TOTAL,C''',TOT=(135,6,PD,ZD,LENGTH=18),C'''')
//*
//STEP0200 EXEC PGM=SORT,PARM='RC16=ABE'
//SYSOUT DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S,DISP=SHR
//SORTIN DD DSN=Your input 148 byte trailer file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,NULLOUT=RC16,STOPAFT=1
INCLUDE COND=(11,10,ZD,EQ,REC_COUNT,AND,51,18,CH,EQ,SUM_TOTAL)
//* |
|
|
Back to top |
|
 |
Aleksandra Sirota
New User
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
|
|
|
|
Skolusu !
Thank you very much !
Can you please explain to me why are you using all these apostrofies After C :
'SUM_TOTAL,C''',TOT=(135,6,PD,ZD,LENGTH=18),C'''')
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 ? |
|
Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Aleksandra Sirota wrote: |
Skolusu !
Thank you very much !
Can you please explain to me why are you using all these apostrofies After C :
'SUM_TOTAL,C''',TOT=(135,6,PD,ZD,LENGTH=18),C'''')
|
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. |
|
Back to top |
|
 |
Aleksandra Sirota
New User
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 |
|
Back to top |
|
 |
Skolusu
Senior Member
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.
Code: |
SORT FIELDS=COPY,SKIPREC=1
|
|
|
Back to top |
|
 |
Aleksandra Sirota
New User
Joined: 29 Jun 2010 Posts: 12 Location: Mettawa, il
|
|
|
|
Thanks a lot . It works.
I'm so sorry but I have another problem with this sort.
When we are doing the SUM in the data file , we are getting the end result in ASCII format :
Command ===>
********************************
SUM_TOTAL,C'00006254618956160'
********************************
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 ? |
|
Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Aleksandra Sirota wrote: |
Thanks a lot . It works.
I'm so sorry but I have another problem with this sort.
When we are doing the SUM in the data file , we are getting the end result in ASCII format :
Command ===>
********************************
SUM_TOTAL,C'00006254618956160'
********************************
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
Code: |
{ABCDEFGHI}JKLMNOPQR
CCCCCCCCCCDDDDDDDDDD
01234567890123456789
|
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. |
|
Back to top |
|
 |
rohanthengal
Active User
.jpg)
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
i have similar problem of counting the record in the trailer,
but i want to map the output of COUNT in trailer to S9(9) comp-3. |
|
Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
rohanthengal wrote: |
i have similar problem of counting the record in the trailer,
but i want to map the output of COUNT in trailer to S9(9) comp-3. |
Somebody will answer to your this post.. Don't ask same question everywhere..
www.ibmmainframes.com/viewtopic.php?t=55760
(Only After you give correct requirement) |
|
Back to top |
|
 |
|
|