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
 

 

Split the file based on comparision result with another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Split the file based on comparision result with another file
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 Moderator


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

PostPosted: Tue Oct 07, 2008 4:24 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Oct 08, 2008 2:09 am    Post subject:
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    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 Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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