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

Combining files using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sat Feb 02, 2008 2:41 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top