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

Merging file using DFsort


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

New User


Joined: 20 May 2005
Posts: 8

PostPosted: Tue Jun 28, 2005 12:12 pm
Reply with quote

Hi,

I have two files let say A & B . A contains two filelds say F1 & F2, and
B has certain fields say F3,F4,F5,F6. I want a output dataset which will contain all the values of Field F1,F2 that were present in dataset A, alongwith the corresponding fields F4,F5,F6(if value of F1 = F3)but not F3. e.g.
Dataset A has

Code:

F1      F2
--------------
bus    100
can     40
disp   700


Dataset B has

Code:

F3       F4    F5    F6
--------------------------
bus    100l   32P   0.8
can     40l   13G   0.6
jam    900l   23H   0.2


output dataset should have

Code:

F1      F2      F4    F5    F6
-------------------------------
bus    100    100l   32p   0.8
can     40     40l   13G   0.6
disp   700


Can this be done using any of sort option.

Regards,
Amit
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 Jun 28, 2005 9:56 pm
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=*
//IN1 DD *
bus    100
can     40
disp   700
/*
//IN2 DD *
bus    100l   32P   0.8
can     40l   13G   0.6
jam    900l   23H   0.2
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
 COPY FROM(IN2) TO(T1) USING(CTL1)
 COPY FROM(IN1) TO(T1) USING(CTL2)
 SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(8,3) WITH(81,1) -
   KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,4,15:8,16,81:C'22')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,80,81:C'11')
/*
//CTL3CNTL DD *
   OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'22'),
    OUTREC=(1,80)
/*
Back to top
View user's profile Send private message
amitkumar_sindhi

New User


Joined: 20 May 2005
Posts: 8

PostPosted: Wed Jun 29, 2005 6:21 pm
Reply with quote

Thanks a lot, the above jcl will work fine if there is no dups in
dataset B. But in my case dataset B can have dups values in it like

bus 100l 32l 0.8
bus 200l 31l 0.9
can 40l 13g 0.6
jam 900l 23h 0.2
jam 100l 13h 0.1

and i want all the duplicate occurrences to be in the output datasets
which are there in dataset A(if value of F1 = F3).The output should be.
F1 F2 F4 F5 F6
-------------------------------
bus 100 100l 32p 0.8
bus 100 200l 31p 0.9
can 40 40l 13g 0.6
disp 700

Regards,
Amit
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 Jun 29, 2005 8:35 pm
Reply with quote

Quote:
Thanks a lot, the above jcl will work fine if there is no dups in
dataset B. But in my case dataset B can have dups values in it like


Sigh. I gave you the JCL that works for the example you showed me. Then you tell me the JCL doesn't work because you have duplicate records. Why didn't you show that in the example in the first place? I can't read your mind. Please give me all of the details in the future, so I don't have to waste time.

Here's a DFSORT/ICETOOL job that will work with your new example:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
bus    100
can     40
disp   700
/*
//IN2 DD *
bus    100l   32l   0.8
bus    200l   31l   0.9
can     40l   13g   0.6
jam    900l   23h   0.2
jam    100l   13h   0.1
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//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 -
   WITHALL WITH(15,17) WITH(81,1)  USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,80,81:C'11')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,4,15:8,16,81:C'22')
/*
//CTL3CNTL DD *
   OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'22'),
    OUTREC=(1,80)
/*
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Fri Jul 01, 2005 6:17 am
Reply with quote

and nary a whisper of thanks. icon_sad.gif


However, I and countless others thank you Frank for time spent answering questions with incomplete information.


Dave
Back to top
View user's profile Send private message
amitkumar_sindhi

New User


Joined: 20 May 2005
Posts: 8

PostPosted: Fri Jul 01, 2005 10:09 am
Reply with quote

Hi Frank,

First of all i am very sorry for all the mistakes i have made from start till end whether its respect to incomplete requirement provided intially or delay i have made in giving the much deserved thanks to you.
Thanks a lot Frank for all your help and time. The JCL provided by you not only helped me saved my time but i was able to know much more about functionality of ICETOOL.

Thanks & Regards,
Amit
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: Fri Jul 01, 2005 8:51 pm
Reply with quote

Thanks for the kind words, Dave.

Amit,

I'm glad I could help. Just try to give more complete information the first time for future questions.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Thu Jul 07, 2005 1:20 pm
Reply with quote

hi,

what does C'11' and C'22' signifies in the OUTREC of solution?

Please help me to know on this.


Regards,

Push.
Back to top
View user's profile Send private message
amitkumar_sindhi

New User


Joined: 20 May 2005
Posts: 8

PostPosted: Thu Jul 07, 2005 1:43 pm
Reply with quote

It will append 11 & 22 at the postion 81 of output record. Used to differntiate from which file the input has come.

Regards,
Amit
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Thu Jul 07, 2005 4:37 pm
Reply with quote

amitkumar_sindhi wrote:
thankz amit for your quick reply.

regards,
push
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 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
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top