IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To find no of counts for for each Exception code in file?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Thu Jun 25, 2009 6:40 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 25, 2009 7:13 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 25, 2009 8:35 pm
Reply with quote

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
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri Jun 26, 2009 9:03 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 26, 2009 9:14 am
Reply with quote

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
View user's profile Send private message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Fri Jun 26, 2009 11:18 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top