Query on record count in ICETOOL
Moderators: Frank Yaeger, Moderator Group
Query on record count in ICETOOL
Hi,
I'm having 2 files and in a single step I want to count individual records
from both the files and put the individual count in the same output file.
ex:
//STEP1 EXEC PGM=ICETOOL
//SORTIN DD DSN=A.B.C, >>>>> file1 having 2 records
// DISP=(SHR,KEEP,KEEP)
// DD DSN=X.Y.Z,
// DISP=(SHR,KEEP,KEEP) >>>>>> file2 having 4 records
Expected O/P format :
FILE1 2
FILE2 4
I want to do the above in q single step.
Could you please guide me on the same?
Is the same possible in DFSORT?
Thanks & Regards
Biswa.
I'm having 2 files and in a single step I want to count individual records
from both the files and put the individual count in the same output file.
ex:
//STEP1 EXEC PGM=ICETOOL
//SORTIN DD DSN=A.B.C, >>>>> file1 having 2 records
// DISP=(SHR,KEEP,KEEP)
// DD DSN=X.Y.Z,
// DISP=(SHR,KEEP,KEEP) >>>>>> file2 having 4 records
Expected O/P format :
FILE1 2
FILE2 4
I want to do the above in q single step.
Could you please guide me on the same?
Is the same possible in DFSORT?
Thanks & Regards
Biswa.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can use a DFSORT/ICETOOL job like the following:
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=A.B.C, >>>>> file1 having 2 records
// DISP=(SHR,KEEP,KEEP)
//IN2 DD DSN=X.Y.Z,
// DISP=(SHR,KEEP,KEEP) >>>>>> file2 having 4 records
//**>> Use a MOD output file for //OUT
//OUT DD DISP=MOD,DSN=... MOD output file
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE2',5X,COUNT=(M10,LENGTH=5))
/*
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,
Thanks for your support.I'm having a another query on the same.
Is there anyway we can avoid writing into O/P files with COUNT of recs as 0 in the below step.(Ex: Suppose file1 contains 0 records)
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
Thanks for your support.I'm having a another query on the same.
Is there anyway we can avoid writing into O/P files with COUNT of recs as 0 in the below step.(Ex: Suppose file1 contains 0 records)
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Remya,
Please start a new thread for your question since it is NOT related to this thread. In the new thread, give the starting position and length of each input field, and the RECFM and LRECL of the input file and output file.
Please start a new thread for your question since it is NOT related to this thread. In the new thread, give the starting position and length of each input field, and the RECFM and LRECL of the input file and 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
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
What if one file is empty and the other isn't? What if both files are empty? Please describe what you want to do and show the expected output for all cases.Is there anyway we can avoid writing into O/P files with COUNT of recs as 0 in the below step.(Ex: Suppose file1 contains 0 records)
When you say "avoid writing into O/P files", do you mean avoid writing into the final output file, or do you mean avoid writing into ANY output file such as a temporary file used to determine whether to write into 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
Frank Yaeger,
1. File1 is having 0 records.
2. File2 is having 2 records.
Below JCL will write the final output file
(//OUT DD DISP=MOD,DSN=... MOD output file) as:
FILE1 0
FILE2 2
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE2',5X,COUNT=(M10,LENGTH=5))
/*
My query is I want to write the final output file
(//OUT DD DISP=MOD,DSN=... MOD output file) as:
FILE2 2
Is there anyway we can check the same in the CTL card,like if FILE1 is having record count 0 don't write to the file (//OUT DD DISP=MOD,DSN=... MOD output file).
If both I/P files are empty I want the final O/P file with no records.
If not how it can be achived.
Thanks & Regards
Biswa.
1. File1 is having 0 records.
2. File2 is having 2 records.
Below JCL will write the final output file
(//OUT DD DISP=MOD,DSN=... MOD output file) as:
FILE1 0
FILE2 2
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('FILE2',5X,COUNT=(M10,LENGTH=5))
/*
My query is I want to write the final output file
(//OUT DD DISP=MOD,DSN=... MOD output file) as:
FILE2 2
Is there anyway we can check the same in the CTL card,like if FILE1 is having record count 0 don't write to the file (//OUT DD DISP=MOD,DSN=... MOD output file).
If both I/P files are empty I want the final O/P file with no records.
If not how it can be achived.
Thanks & Regards
Biswa.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT/ICETOOL job that will produce the output you asked for:
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=A.B.C, >>>>> file1 having 2 records
// DISP=(SHR,KEEP,KEEP)
//IN2 DD DSN=X.Y.Z,
// DISP=(SHR,KEEP,KEEP) >>>>>> file2 having 4 records
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
COPY FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
TRAILER1=('FILE1',5X,COUNT=(M10,LENGTH=5))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
TRAILER1=('FILE2',5X,COUNT=(M10,LENGTH=5))
/*
//CTL3CNTL DD *
OMIT COND=(11,5,FS,EQ,0)
/*
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
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