View previous topic :: View next topic
|
Author |
Message |
babu_hi
New User
Joined: 11 Apr 2006 Posts: 93
|
|
|
|
I have a input file and it contains 'E','A','c' and 'H' records.i want to extract only 'E' record.
The 'E' type record contains the Exception code(2-5 positions) and Description.
Now i want to count the each exception appear in a file.Suppose Exception code '8005' appear 10 times in a input file.I have 400 types Exception codes.If i use Cobol Evaluate or IF statement i need to check conditions for 400 exceptions then the program is too big to avoid that is there any option for this requirement.
My output file should be like below
exception code/ No of Times Appear
8005 / 10
8007 / 7
1005 / 17
The 'E' Record looks like below,
E8005INSUFFICIENT FUNDS
E8007UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
E8007UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
E8007UNAVAILABLE FUNDS
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
E8007UNAVAILABLE FUNDS
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E7 UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
Please tell me how we can handle this requirement thru JCL SORT or COBOL.If the solution thru JCL SORT is better.If there not possible thru the JCL SORT then COBOL sample code required? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
The 'E' type record contains the Exception code(2-5 positions) and Description. |
according to your examples this is not true.
here are the last 8:
Code: |
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
E8007UNAVAILABLE FUNDS
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E7 UNAVAILABLE FUNDS
E8005INSUFFICIENT FUNDS
|
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
babu_hi,
use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
P8005 INSUFFICIENT FUNDS
E8005 INSUFFICIENT FUNDS
E8007 UNAVAILABLE FUNDS
E8005 INSUFFICIENT FUNDS
E8007 UNAVAILABLE FUNDS
E8005 INSUFFICIENT FUNDS
E8007 UNAVAILABLE FUNDS
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E8005 INSUFFICIENT FUNDS
E8007 UNAVAILABLE FUNDS
E5 INSUFFICIENT FUNDS
E7 UNAVAILABLE FUNDS
E7 UNAVAILABLE FUNDS
E8005 INSUFFICIENT FUNDS
P8005 INSUFFICIENT FUNDS
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,1,CH,EQ,C'E')
SORT FIELDS=(2,5,CH,A)
OUTFIL BUILD=(80X),REMOVECC,NODETAIL,
HEADER1=('EXCP CODE ',' COUNT',/,'=========',X,'========='),
SECTIONS=(2,5,TRAILER3=(2,5,6X,COUNT))
/* |
This will produce
Code: |
EXCP CODE COUNT
========= =========
5 2
7 3
8005 5
8007 4
|
|
|
Back to top |
|
|
babu_hi
New User
Joined: 11 Apr 2006 Posts: 93
|
|
|
|
Hi dbzTHEdinosauer,
May be Exception code description is same for more than one Exception code,so i want only the output for each exception code how times appear in the file like below.
Code: |
EXCP CODE COUNT
========= =========
5 2
7 3
8005 5
8007 4
|
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
so i want only the output for each exception code how times appear in the file like below. |
Yes, now that you have seen the output from the posted solution. . .
The original "expected output" did not match the posted sample input. . .
You will not always have the good fortune that someone will do what you want from an inconsistent requirement. |
|
Back to top |
|
|
babu_hi
New User
Joined: 11 Apr 2006 Posts: 93
|
|
|
|
Thanks Skolusu.
your sort is working now my requirement is fulfill with u r post.
Thank you very much for your post. |
|
Back to top |
|
|
|