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

Compare key in two files and write count


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 3:08 pm
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
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: 123
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 6:35 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top