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
 

 

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 member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm


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