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

Split the file based on comparision result with another file


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

New User


Joined: 21 Oct 2006
Posts: 9

PostPosted: Tue Oct 07, 2008 3:28 am
Reply with quote

Hi,

My requirement is, I have two files (A & B) and for all the records in File A, I need to check with File B (match with Pol Num) and based on Int Company of File B, I need to split the file A into File A and File C.

Input Files:
----------------------
File A
Pol Num Name Pol Date Company
5 10 8 1
12345 aaaaa 01142007 8
46457 bbbbb 01012008 8
89789 gdfdfg 10312006 8
55555 gfgdgfd 12302007 8
66666 trgfgh 01012007 8

File B
Pol Num Int Company
12345 1
46457 6
89789 1
55555 1
66666 6

Output Files :
------------------------
File A
Pol Num Name Pol Date Company
5 10 8 1
12345 aaaaa 01142007 8
89789 gdfdfg 10312006 8
55555 gfgdgfd 12302007 8

File C
Pol Num Name Pol Date Company
5 10 8 1
46457 bbbbb 01012008 8
66666 trgfgh 01012007 8

Can anyone tell , whether I can do this with ICETOOL and SPLICE.

Appreciate your help.
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: Tue Oct 07, 2008 4:24 am
Reply with quote

What is the RECFM and LRECL of input file1? What is the RECFM and LRECL of input file2?

What is the starting position, length and format of each field in input file1?
What is the starting position, length and format of each field in input file2?

Does every policy number in input file1 appear in input file2 as in your example? Does input file1 have no duplicates within it as in your example? Does input file2 have no duplicates within it as in your example? If not, show a better example with all of the possible variations.

Do you need the output records in their original order by policy number or can they be in order by policy number?
Back to top
View user's profile Send private message
beeeru

New User


Joined: 21 Oct 2006
Posts: 9

PostPosted: Tue Oct 07, 2008 11:14 pm
Reply with quote

Hi Frank,

Appreciate your quick response. I wish I had given all the detail you asked for.

File A & File C
RECFM = FB, LRECL = 33
Fields : POLNUM NAME COMPANY PAYMENT PAYMENT-DATE
Size : 5 10 1 9 8

File B
RECFM = FB, LRECL = 14
Fields : POLNUM INT-COMPANY POL-DATE
Size : 5 1 8

Every Policy Number in File A will be there in File B. File A and File B can contain duplicate rows(I just gave few fields in file B as the original file is of 3000 bytes, assuming that I can play around), but corresponding companies will be same for that policy number i.e for every pol-no in File A will have only one int-company in File B.

Output files can be of any order.

Attached is an example. Hope this example is a better one.

Thanks Once again for your help, Frank.
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 Oct 08, 2008 2:09 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=... input fileA (FB/33)
//FILEB DD DSN=... input fileB (FB/14)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=...  output fileC (FB/33)
//FILED DD DSN=...  output fileD (FB/33)
//TOOLIN DD *
COPY FROM(FILEB) TO(T1) USING(CTL1)
COPY FROM(FILEA) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(1,5,CH) WITHALL -
  WITH(1,33) WITH(35,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(34:6,1,35:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(35:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILEC,
    INCLUDE=(35,2,CH,EQ,C'VB',AND,34,1,CH,EQ,C'1'),
    BUILD=(1,33)
  OUTFIL FNAMES=FILED,
    INCLUDE=(35,2,CH,EQ,C'VB',AND,34,1,CH,EQ,C'6'),
    BUILD=(1,33)
/*
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top