Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To find no of counts for for each Exception code in file?
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    Post subject:
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    Post subject: Reply to: To find no of counts for for each Exception code i
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    Post subject:
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

Site Director


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

PostPosted: Fri Jun 26, 2009 9:14 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us