Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Split file based on comparsion to 2 fields in 2nd file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Div Grad

New User


Joined: 08 Apr 2005
Posts: 45

PostPosted: Thu Jul 27, 2017 9:16 pm    Post subject: Split file based on comparsion to 2 fields in 2nd file
Reply with quote

I have a file of customer ids and dates those customers had service. I also have a file of when those same customers received a mailing. What I want to do is take that first file of customer ids and service dates and split it into two files:
- service that occurred before a mailing
- service that occurred after, or on, a mailing

So for example if I had this file of mailing dates for customers AA, BA, and CA:

Code:

AA2017-03-15
BA2017-03-11
CA2017-03-21


and this file of customer service history:

Code:

AA2017-03-05
AA2017-03-08
AA2017-03-15
AA2017-03-25
BA2017-03-04
BA2017-03-09
BA2017-03-12
BA2017-03-28
CA2017-03-07
CA2017-03-19
CA2017-03-22
CA2017-03-24


Then as output I would want two files. The first being this list of Customer Service dates that occurred before a customer received a mailing:

Code:

AA2017-03-05
AA2017-03-08
BA2017-03-04
BA2017-03-09
CA2017-03-07
CA2017-03-19


and this list of service after, or day of, a mailing:

Code:

AA2017-03-15
AA2017-03-25
BA2017-03-12
BA2017-03-28
CA2017-03-22
CA2017-03-24


Thanks in advance!
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 189
Location: Maryland

PostPosted: Thu Jul 27, 2017 11:20 pm    Post subject:
Reply with quote

Code:
 JOINKEYS F1=...
 JOINKEYS F2=...
 REFORMAT FIELDS=...
 SORT FIELDS=COPY
 OUTFIL FNAMES=BEFORE,INCLUDE=...,BUILD=...
 OUTFIL FNAMES=AFTER,INCLUDE=...,BUILD=...
 END


RTFM
Back to top
View user's profile Send private message
Div Grad

New User


Joined: 08 Apr 2005
Posts: 45

PostPosted: Fri Jul 28, 2017 12:45 am    Post subject:
Reply with quote

sergeyken - Thanks for the feedback, I got it now! I think I was trying to make it more difficult than needed.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 189
Location: Maryland

PostPosted: Fri Jul 28, 2017 1:26 am    Post subject:
Reply with quote

After JOINKEYS, the order of joined records is not guaranteed by SORT; it depends on the joining method actually used.
If specific order of final records is strictly required, then explicit SORT FILEDS=(...) might be needed.
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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us