SORT - COUNT
Moderators: Frank Yaeger, Moderator Group
SORT - COUNT
Hi,
I have the input file RECL=80 that contains the file name and type-2 constant, and type-3 constant. I need to read the file name between positions 1 and 21 and count the number of '2' 's in that file at position 4 and write the count of type-2 after TYPE-2= and similar way write the count of type-3 after TYPE=3. Out file should contain the file name along with count of 2 & 3's
Input file is like this:
AAAA.BBBB.CCCC.D0301-TYPE-2=---------- TYPE-3=----------
AAAA.BBBB.CCCC.D0302-TYPE-2=---------- TYPE-3=----------
Output file should be like this:
AAAA.BBBB.CCCC.D0301-TYPE-2=0000000254 TYPE-3=0000000890
AAAA.BBBB.CCCC.D0302-TYPE-2=1234567890 TYPE-3=1234567890
Is it possible to do using sort? only DFSORT, we dont have ICETOOL
I have the input file RECL=80 that contains the file name and type-2 constant, and type-3 constant. I need to read the file name between positions 1 and 21 and count the number of '2' 's in that file at position 4 and write the count of type-2 after TYPE-2= and similar way write the count of type-3 after TYPE=3. Out file should contain the file name along with count of 2 & 3's
Input file is like this:
AAAA.BBBB.CCCC.D0301-TYPE-2=---------- TYPE-3=----------
AAAA.BBBB.CCCC.D0302-TYPE-2=---------- TYPE-3=----------
Output file should be like this:
AAAA.BBBB.CCCC.D0301-TYPE-2=0000000254 TYPE-3=0000000890
AAAA.BBBB.CCCC.D0302-TYPE-2=1234567890 TYPE-3=1234567890
Is it possible to do using sort? only DFSORT, we dont have ICETOOL
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Your explanation of what you want is a bit confusing, but going by the input and expected output you showed, I believe this DFSORT job will do what you asked for:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),
IFTHEN=(WHEN=(27,1,CH,EQ,C'2'),OVERLAY=(81:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(45,1,CH,EQ,C'3'),OVERLAY=(82:C'1'))
SORT FIELDS=(1,21,CH,A)
OUTFIL REMOVECC,NODETAIL,
BUILD=(1,80),
SECTIONS=(1,21,
TRAILER3=(1,28,29:TOT=(81,1,ZD,TO=ZD,LENGTH=10),
40:40,7,TOT=(82,1,ZD,TO=ZD,LENGTH=10)))
/*
This statement makes no sense. If you have DFSORT, then you have DFSORT's ICETOOL. ICETOOL has been shipped free with DFSORT since 1991!Is it possible to do using sort? only DFSORT, we dont have ICETOOL
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
Thank you frank for the reply.
I am changing the requirement to make it clear:
I have 100 files. I want to get the record counts from each file and write the count along with the file name in the output file. Do I need to code many steps to get the counts from each file? or any simple method by using the sort.
I am changing the requirement to make it clear:
I have 100 files. I want to get the record counts from each file and write the count along with the file name in the output file. Do I need to code many steps to get the counts from each file? or any simple method by using the sort.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
DFSORT can write a count for one file at a time in various ways. You could use ICETOOL with multiple operators to do counts for multiple files in various ways. But DFSORT does not have any built-in function for displaying the file name of the input file.
REXX might be a better choice for this kind of thing.
REXX might be a better choice for this kind of thing.
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
Ok. Lets say I got all the counts of the files and I need to format it now like this.
File1 contains the file names and its count information. File2 is report, it contains the formatted input file1 information. I want to take the 1st 5 chars from the input file1 and then put the 23 chars (from 7th char) in the next line in the file2 wherever 1st 5 chars matches.
Input File1(RECL=80, FB):
File2:(RECL=133,FBA) - before update
If there is any confusion in the requirement, I'll rephrase it.
File1 contains the file names and its count information. File2 is report, it contains the formatted input file1 information. I want to take the 1st 5 chars from the input file1 and then put the 23 chars (from 7th char) in the next line in the file2 wherever 1st 5 chars matches.
Input File1(RECL=80, FB):
Code: Select all
FILE1:INT=0001234;EXT=0003456
FILE2:INT=0001225;EXT=0008798
FILE3:INT=0000054;EXT=0006798
Code: Select all
DATE: PAGE#:
------------------------
------------------------
FILE1
FILE2
FILE3
Output:
DATE: PAGE#:
------------------------
------------------------
FILE1
INT=0001234;EXT=0003456
FILE2
INT=0001225;EXT=0008798
FILE3
INT=0000054;EXT=0006798
sri123,
The following DFSORT/ICETOOL JCL will give you the desired results
I assumed the following.
1. The filename in report file starts at pos 12 for 5 bytes.
2. The header is of 3 lines.
3. I assumed that every record in file 1 has a matching record in file 2
The output from this job is
The following DFSORT/ICETOOL JCL will give you the desired results
I assumed the following.
1. The filename in report file starts at pos 12 for 5 bytes.
2. The header is of 3 lines.
3. I assumed that every record in file 1 has a matching record in file 2
Code: Select all
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
FILE1:INT=0001234;EXT=0003456
FILE2:INT=0001225;EXT=0008798
FILE3:INT=0000054;EXT=0006798
//SORTOUT DD DSN=&&F1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(12:1,80,133:X)
/*
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your 133 byte report file f2,DISP=SHR
// DD DSN=&&F1,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER(3) USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(12,5,CH,A),EQUALS
OUTFIL FNAMES=OUT,
IFTHEN=(WHEN=(17,5,CH,EQ,C':INT='),OVERLAY=(12:18,75))
//*
Code: Select all
DATE: PAGE#:
------------------------
------------------------
FILE1
INT=0001234;EXT=0003456
FILE2
INT=0001225;EXT=0008798
FILE3
INT=0000054;EXT=0006798
Hi Kolusu,
Thank you for reply.
Header consists of not only 3 records and these records not in one after the other. In between, there may be another file names. So, whenever file1 found in the file2, counts need to be copied to the next line at the same position.
For the previous example, I'm getting the below error. Am I missing some thing?
Thank you for reply.
Header consists of not only 3 records and these records not in one after the other. In between, there may be another file names. So, whenever file1 found in the file2, counts need to be copied to the next line at the same position.
For the previous example, I'm getting the below error. Am I missing some thing?
Code: Select all
SYT000I SYNCTOOL RELEASE 1.5.3 - COPYRIGHT 2004 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED
DATASORT FROM(IN) TO(OUT) HEADER(3) USING(CTL1)
SYT048E STATEMENT DOES NOT BEGIN WITH A VALID OPERATOR
SYT030I OPERATION COMPLETED WITH RETURN CODE 12
SYT015I PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE
SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12
Well, the messageSRI123 wrote:For the previous example, I'm getting the below error. Am I missing some thing?
SYT000I SYNCTOOL RELEASE 1.5.3 - COPYRIGHT 2004 SYNCSORT INC.
indicates that you're using Syncsort/Synctool, not DFSORT/ICETOOL, and that DATASORT is not a valid operator for the Syncsort product. You should be posting to that forum, or reviewing the Syncsort product manuals for an equivalent Syncsort command.
MrSpock,
I think this forum represents SyncSort as well.
SRI,
Which SyncSort version do you have there?
I think this forum represents SyncSort as well.
DFSORT , ICETOOL & Utilities
In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities
The latest SYNCTOOL version - SYNCTOOL RELEASE 1.6.2 (shipped with the SyncSort 1.3.2) supports the DATASORT function.DATASORT is not a valid operator for the Syncsort product
SRI,
Which SyncSort version do you have there?
Arun
-
- Member
- Posts: 25
- Joined: Tue Apr 28, 2009 10:53 pm
- Location: USA
- Contact:
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