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

Processing 2 record format to find the record count


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

New User


Joined: 04 Dec 2006
Posts: 6
Location: Pune,India

PostPosted: Sun May 25, 2008 12:36 am
Reply with quote

Hi all,

I currently have a situation where I have 2 fixed length file with record format Type1 and Type2 respectively:-

File1

key1,field11, field12, Type2-record-count

File2

key1,field21, field22


So for each record in File1 there could be multiple record in File2
which are linked through the key1.

I need to populate 'Type2-record-count' with the no. of occurances of records in file2.

Is is possible to use a ICETOOL to solve this problem. Can you please suggest me an idea.

Thanks and Regards,
Thiru
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun May 25, 2008 8:56 pm
Reply with quote

Please show an example of the records in each input file (relevant fields only) and what you expect for output. If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it show that in your example. Explain the rules for getting from input to output.

Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field in each input file.
Back to top
View user's profile Send private message
thirunarayanan_sampath

New User


Joined: 04 Dec 2006
Posts: 6
Location: Pune,India

PostPosted: Wed Jun 04, 2008 9:35 am
Reply with quote

Hi Frank,

Please find the details of the file information and its records

File 1

Sort Code No of occurance in file2
(key field/no duplicates)

123456 02
123457 03
123458 04


File 2

Sort Code Party Id
(Key field/with dup) (duplicates allowed but not for same key field)

123456 1111111111
123456 2222222222

123457 1111111111
123457 3333333333
123457 5555555555

123458 1111111111
123458 1111111115
123458 1111111114
123458 1111111113
123458 1234567890
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jun 04, 2008 8:53 pm
Reply with quote

Are you saying that you want to count the number of values for a key in file2, and overlay that count into the No of occurance field in file1 for that key?

In your example, are you showing the input for file1 and file2? If so, would the output for your example be:

Code:

123456                               02
123457                               03
123458                               05


Again: Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field in each input file.
Back to top
View user's profile Send private message
thirunarayanan_sampath

New User


Joined: 04 Dec 2006
Posts: 6
Location: Pune,India

PostPosted: Thu Jun 05, 2008 9:12 am
Reply with quote

Hi Frank,

Yes the requirement is to count the number of values for each key in file2 and overlay the count into '' No of occurance'' field in file1.

Yes Eventually, the count should be updated in the file1 and output is :-

file1

123456 02
123457 03
123458 05

LRECL of both files = 80
key field start at pos 1 for both files and of 6 characters in length.

''No of occurance'' field in file1 starting position = 7, length = 2

''Party id'' field in file2 starting posiyion = 7, length = 10
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 05, 2008 10:49 pm
Reply with quote

thirunarayanan_sampath,

The following DFSORT/ICETOOL JCl will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD *                                               
123456 02                                                     
123457 03                                                     
123458 04                                                     
//IN2      DD *                                               
123456 1111111111                                             
123456 2222222222                                             
123457 1111111111                                             
123457 3333333333                                             
123457 5555555555                                             
123458 1111111111                                             
123458 1111111115                                             
123458 1111111114                                             
123458 1111111113                                             
123458 1234567890                                             
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SORT FROM(IN2) USING(CTL1)                                 
  COPY FROM(IN1) USING(CTL2)                                 
  SPLICE FROM(T1) TO(OUT) ON(1,6,CH) KEEPNODUPS -             
  WITHALL WITH(01,09) USING(CTL3)                             
//CTL1CNTL DD *                                               
  SORT FIELDS=(1,6,CH,A)                                     
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,BUILD=(11X),             
  SECTIONS=(1,6,                                             
  TRAILER3=(1,6,3X,COUNT=(M11,LENGTH=2)))                     
//CTL2CNTL DD *                                               
  OUTFIL FNAMES=T1,BUILD=(1,9,2X)                             
//CTL3CNTL DD *                                               
  OUTFIL FNAMES=OUT,BUILD=(1,7,10,2)                         
/*


Hope this helps...

Cheers
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 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top