How to update records count in the header using JCL
Moderators: Frank Yaeger, DikDude, Moderator Group
How to update records count in the header using JCL
Hi,
Suppose, I have file with '10' records. The header is showing the count of all records in the file. This file has some duplicate records.... say for ex. 2 duplicate records.
I need to create a new file by remove the duplicate records and updating count in the header record. i.e. my new file should have 8 records (after removing the 2 duplicate records from the file of 10 records) and header record should show the count as 8.
Please note that record counts and duplicate records will vary from file to file. How can i achieve this by JCL. We can remove duplicate records by using SORT utility. But, can we update the count in the header record dynamically by using jcl.
Thanks for your time.
Suppose, I have file with '10' records. The header is showing the count of all records in the file. This file has some duplicate records.... say for ex. 2 duplicate records.
I need to create a new file by remove the duplicate records and updating count in the header record. i.e. my new file should have 8 records (after removing the 2 duplicate records from the file of 10 records) and header record should show the count as 8.
Please note that record counts and duplicate records will vary from file to file. How can i achieve this by JCL. We can remove duplicate records by using SORT utility. But, can we update the count in the header record dynamically by using jcl.
Thanks for your time.
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
3 questions:
how is the header record identified?
what is the criterea for duplicate records? (i.e. pos, length, type) attempt to make this compare size as small as possible.
what are the DCB parameters for you input file - I assume your output file will be the same.
how is the header record identified?
what is the criterea for duplicate records? (i.e. pos, length, type) attempt to make this compare size as small as possible.
what are the DCB parameters for you input file - I assume your output file will be the same.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
nanda,
Please show an example of the records in your input file and the expected output records. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.
Please show an example of the records in your input file and the expected output records. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 1
- Joined: Mon Mar 26, 2007 2:24 pm
* Header record will start with AX10 and detail records starts with DRxxx
* criterea for duplicate records: SORT FIELDS=(1,13,CH,A)
* RECFM = VB
* LRECL = 304
* starting position, length and format of the field you are using to check
for duplicates = (1, 13, CHAR) i.e. SORT FIELDS=(1,13,CH,A)
* In the header, record count is from pos 59-62 (length of 4 char)
* Input file and Output file are of same format and length.
Please let me know if you need any other information. Thanks in Advance
* criterea for duplicate records: SORT FIELDS=(1,13,CH,A)
* RECFM = VB
* LRECL = 304
* starting position, length and format of the field you are using to check
for duplicates = (1, 13, CHAR) i.e. SORT FIELDS=(1,13,CH,A)
* In the header, record count is from pos 59-62 (length of 4 char)
* Input file and Output file are of same format and length.
Please let me know if you need any other information. Thanks in Advance
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Again: Please show an example of the records in the input file (just the relevant fields) and the records you expect in the output file.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Sample input file:
--------------------
Header:
---------
AX00 20070804025000RAMTX00056790 00000000051357
* Here 0005 is the records count excluding hdr record and it starts
from pos. 59
Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2 --> Duplicate record
DRAPBBXA2 --> Duplicate record
DRAPBBXA3
Sample output file should be ....
--------------------------------
Header:
---------
AX00 20070804025000RAMTX00056790 00000000041357
Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2
DRAPBBXA3
* One duplicate record(DRAPBBXA2) from the i/p file removed and the
record count in the header is updated from 5 to 4.
--------------------
Header:
---------
AX00 20070804025000RAMTX00056790 00000000051357
* Here 0005 is the records count excluding hdr record and it starts
from pos. 59
Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2 --> Duplicate record
DRAPBBXA2 --> Duplicate record
DRAPBBXA3
Sample output file should be ....
--------------------------------
Header:
---------
AX00 20070804025000RAMTX00056790 00000000041357
Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2
DRAPBBXA3
* One duplicate record(DRAPBBXA2) from the i/p file removed and the
record count in the header is updated from 5 to 4.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT job that will do what you asked for. Since the input file is VB, we need to add 4 bytes (for the RDW) to your starting positions. I assumed that the header record can be identified by the 'A' in position 1.
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=(5,13,CH,A)
SUM FIELDS=NONE
OUTFIL FNAMES=T1
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,VTOF,
BUILD=(80X),
TRAILER1=('NEWCT,''',COUNT-1=(M11,LENGTH=4),C'''')
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'A'),
OVERLAY=(63:NEWCT))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Hi Frank,
Thanks for the DFSORT job. It is working as per expectations. But, when i am checking for syntax errors, i am getting the following error msg...(but the job ended with rc 00). Could you explain why it is so? Thanks for your time.
Sev Msg No. Message Text
-----------------------------------------------------
E1 8 DSS10065E Parameter 'COUNT-1' is unidentified.
Thanks for the DFSORT job. It is working as per expectations. But, when i am checking for syntax errors, i am getting the following error msg...(but the job ended with rc 00). Could you explain why it is so? Thanks for your time.
Sev Msg No. Message Text
-----------------------------------------------------
E1 8 DSS10065E Parameter 'COUNT-1' is unidentified.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Huh? Checking for syntax errors how? If you received a DFSORT syntax error, it would be an ICExxxA message and you would not get RC=0.
This message is NOT from DFSORT. What program are you running that produces this error message?E1 8 DSS10065E Parameter 'COUNT-1' is unidentified.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can use a similar (though not identical) job for an FB file.
Please show me an example of the records in your input file and what you expect for output. Tell me the LRECL of the input file. Tell me the starting position, length and format of all relevant fields. Tell me how you identify the header and data records.
Please show me an example of the records in your input file and what you expect for output. Tell me the LRECL of the input file. Tell me the starting position, length and format of all relevant fields. Tell me how you identify the header and data records.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Sample file:
Header: (1,5,ch,eq,'00000') or (6,4,eq,'UHL1')
Trailer: (1,5,ch,eq,'99999') or (6,4,eq,'UTL1').
The file first has to be sorted on the following criteria:
(6,20,CH,A,1,5,CH,A,26,1,CH,D,27,3,CH,D,30,8,CH,D,38,8,CH,D). After this duplicate needs to be removed based on (6,20,CH). I believe we would have to use two steps for this. first to sort on required criteria, but when duplicates are removed only (6,20,CH) should be considered. So its prob better to use a second step with Select rather than sum fields = none. LRECL=60 and RECFM = FB. Please let me know if you need more info.
Code: Select all
00000UHL1091109CBHCF
1001067578932000000148831000000000000200704100001004
1000567578932000000148831000000000000200704100001005
1000167578932000000148831000000000000200704100001006
1001067578932000000654893000000000000200702200001008
1000167578932000000654894000000000000200702200001008
1000567578932000000654894000000000000200702200001009
1001067578932000000654892000000000000200702200101011
1001067578932000001003931000000000000200701130101011
1001067578932000001004011000000000000200604050101010
1001067578932000001032311000000000000000000000101012
1000167578932000001208541000020060402200604030001106
1001067578932000001208541000020060402200604030001108
99999UTL100000012
Trailer: (1,5,ch,eq,'99999') or (6,4,eq,'UTL1').
The file first has to be sorted on the following criteria:
(6,20,CH,A,1,5,CH,A,26,1,CH,D,27,3,CH,D,30,8,CH,D,38,8,CH,D). After this duplicate needs to be removed based on (6,20,CH). I believe we would have to use two steps for this. first to sort on required criteria, but when duplicates are removed only (6,20,CH) should be considered. So its prob better to use a second step with Select rather than sum fields = none. LRECL=60 and RECFM = FB. Please let me know if you need more info.
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page