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
 
Combining files using DFSORT

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

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Sat Feb 02, 2008 1:36 am    Post subject: Combining files using DFSORT
Reply with quote

Hi,

I have two input files as

Code:

File 1
COLA    COLB    COLC
111     aaaa    bbb
222     cccc    ddd
333     eeee    fff
444     gggg    hhh
666     uuuu    ttt
777     xxxx    ccc
888     yyyy    ggg

File 2
COLA    COLD    COLE
111     aaaa    bbb
222     cccc    jjj
333     kkkk    fff
555     nnnn    ooo
666             ttt
777     xxxx
888
999


I want to compare these two files, discard the common records and generate file as

Code:

File 3
COLA    COLD    COLE    COLB    COLC    Tag
222     cccc    jjj     cccc    ddd     CH
333     kkkk    fff     eeee    fff     CH
444                     gggg    hhh     DE
555     nnnn    ooo                     IN
666             ttt     uuuu    ttt     NC
777     xxxx            xxxx    ccc     NC
888                     yyyy    ggg     NC
999                                     NI


Tagged as
1. Records with common COLA, have to be tagged CH.
2. Records with common COLA but with COLD or COLE as spaces have to be tagged NC.
3. Records only in FILE1, have to be tagged DE.
4. Records only in FILE2, but with COLD or COLE as spaces, have to be tagged NI.
5. Records only in FILE2, with non space values in COLD and COLE, have to be tagged IN.

There are no duplicates in any of the input files. Both input files are sorted by COLA.

Thanks
Neelu Joshi
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: Sat Feb 02, 2008 2:41 am    Post subject:
Reply with quote

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

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) KEEPNODUPS -
  WITH(9,4) WITH(17,4) WITH(46,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,4,25:9,4,33:17,4,46:C'11')
/*
//CTL2CNTL DD *
  INREC BUILD=(1,20,46:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
    OMIT=(46,2,CH,EQ,C'21',AND,
      9,4,CH,EQ,25,4,CH,AND,17,4,CH,EQ,33,4,CH),
    IFOUTLEN=42,
    IFTHEN=(WHEN=(46,2,CH,EQ,C'11'),OVERLAY=(41:C'DE')),
    IFTHEN=(WHEN=(46,2,CH,EQ,C'22',AND,
      (9,4,CH,EQ,C' ',OR,17,4,CH,EQ,C' ')),OVERLAY=(41:C'NI')),
    IFTHEN=(WHEN=(46,2,CH,EQ,C'22',AND,
      (9,4,CH,NE,C' ',OR,17,4,CH,EQ,C' ')),OVERLAY=(41:C'IN')),
    IFTHEN=(WHEN=(46,2,CH,EQ,C'21',AND,
      (9,4,CH,EQ,C' ',OR,17,4,CH,EQ,C' ')),OVERLAY=(41:C'NC')),
    IFTHEN=(WHEN=NONE,OVERLAY=(41:C'CH'))
/*
Back to top
View user's profile Send private message
NeeluJoshi

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Mon Feb 04, 2008 8:53 pm    Post subject: Reply to: Combining files using DFSORT
Reply with quote

Thanks that works. I aapreciate your help.
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 FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

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