Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare key in two files and write count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Fri Mar 06, 2009 3:08 pm    Post subject: Compare key in two files and write count
Reply with quote

Hi,

Suggest me how to get my output for below requirement.

Here is my input file format:
RECFM=FB, LRECL=80, KEY=(1,4)
Code:

MC    AC_CODES   
6202  A1A2A3A4A5
6202  A2A3A5     
6202  A1A2A3     
6203  A3A5       
6204  A4         
6204  A5         
6205  A1A5       


And i need output as follows:
RECFM=FB, LRECL=80
Code:

MC    A1 A2 A3 A4 A5
6202  2  3  3  1  2 
6203  0  0  1  0  1 
6204  0  0  0  1  1 
6205  1  0  0  0  1 


Input file will be in sorted order on MC Key. For every row of MC there will be one or more than one AC_Codes. Unique AC_Codes will be there in each row. A1, A2, A3, A4... An are the AC_Codes and no delimeter will be there between these AC_Codes. Suggest me how to get my output. Count of all AC_Codes under each MC Key is required in my output.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Mar 06, 2009 5:55 pm    Post subject:
Reply with quote

bhaskar_kanteti
Your topic says "Compare key in two files and write count", but the as per the description there is only one input file. please clarify
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Fri Mar 06, 2009 6:35 pm    Post subject: Reply to: Compare key and write count
Reply with quote

Sorry for confusing. There is only one input file.
Thanks for pointing Krisprem.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Mar 06, 2009 9:56 pm    Post subject: Reply to: Compare key in two files and write count
Reply with quote

bhaskar_kanteti,

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
----+----1----+----2----+----3----+----4----+----5----+----6----
6202  A1A2A3A4A5                                               
6202  A2A3A5                                                   
6202  A1A2A3                                                   
6203  A3A5                                                     
6204  A4                                                       
6204  A5                                                       
6205  A1A5                                                     
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:5C'0')),                 
  IFTHEN=(WHEN=(7,10,SS,EQ,C'A1'),OVERLAY=(81:C'1'),HIT=NEXT), 
  IFTHEN=(WHEN=(7,10,SS,EQ,C'A2'),OVERLAY=(82:C'1'),HIT=NEXT), 
  IFTHEN=(WHEN=(7,10,SS,EQ,C'A3'),OVERLAY=(83:C'1'),HIT=NEXT), 
  IFTHEN=(WHEN=(7,10,SS,EQ,C'A4'),OVERLAY=(84:C'1'),HIT=NEXT), 
  IFTHEN=(WHEN=(7,10,SS,EQ,C'A5'),OVERLAY=(85:C'1'))           
                                                               
  SORT FIELDS=(1,4,CH,A)                                       
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                         
  HEADER1=(' MC:',6:'A1',9:'A2',12:'A3',15:'A4',18:C'A5',/,     
           ' ===',6:'==',9:'==',12:'==',15:'==',18:C'=='),     
  SECTIONS=(1,4,                                               
  TRAILER3=(1,4,X,                                             
            TOT=(81,1,ZD,M10,LENGTH=2),X,                       
            TOT=(82,1,ZD,M10,LENGTH=2),X,                       
            TOT=(83,1,ZD,M10,LENGTH=2),X,                       
            TOT=(84,1,ZD,M10,LENGTH=2),X,                       
            TOT=(85,1,ZD,M10,LENGTH=2)))                       
/*                                                             


The output from this job is

Code:

 MC: A1 A2 A3 A4 A5
 === == == == == ==
6202  2  3  3  1  2
6203  0  0  1  0  1
6204  0  0  0  1  1
6205  1  0  0  0  1
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us