MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MERGE files Using the SPLICE in ICETOOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Fri Mar 23, 2007 10:18 pm    Post subject: MERGE files Using the SPLICE in ICETOOL Reply with quote

File 1: This file is of length 15


Code:

FieldA FieldB FieldC
100    200    1234
101    201    1234
102    202    1111


File 2: This file is of length 25

Code:

FieldA FieldB Field2 Field3 FieldC
100    200     1100  1200  1234
102    202     2100  2200  1111


Output file:

This file should be of length 20

Code:

FieldB FieldC Field2 Field3
200    1234   1100   1200
201    1234
202    1111



where FieldA and FieldB are common to both the files. The output file will contain the fieldB & fieldC from the File 1. File 1 will be the Driver file, if we find a match for the records (fieldA & fieldB) in File 2 then we should populate the Field2 & Field3 from that file to the output file else these two fields should be defaulted in the output file

Please guide me in doing this
Back to top
View user's profile Send private message
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Sat Mar 24, 2007 3:12 am    Post subject: field incompatibilities in the input n output files Reply with quote

there are incompatibilities in the input and output files

In the input files:
Field C - S9(12) Comp-3
Field 2 & Field 3 - S9(9) comp

The Output file:
Field C - 9(12)
Field 2- 9(09)
Field 3 - 9(09)
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Mar 24, 2007 11:05 am    Post subject: Reply with quote

According to your rules, the 202 output record should have all four fields - but you show it with only two fields - why?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Sun Mar 25, 2007 10:30 pm    Post subject: Reply with quote

thats Because it doesnt have a match in the second file, so those fields are defaulted
Back to top
View user's profile Send private message
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Mon Mar 26, 2007 12:05 am    Post subject: Reply with quote

Sorry for the confusion the output file has:
Code:

FieldB FieldC Field2 Field3
200    1234   1100   1200
201    1234
202    1111   2100   2200
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Mar 26, 2007 10:31 am    Post subject: Reply with quote

Please give the starting position, length and format for all of the fields in file1 and all of the fields in file2.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Tue Mar 27, 2007 12:06 am    Post subject: Reply with quote

Hi Frank

File 1:

FieldA FieldB FieldC
1-6 7-26 27-33
100 200 1234
101 201 1234
102 202 1111

FieldA - 1-6 PIC(x)
FieldB - 7-26 PIC(x)
FieldC - 27-33 S9(12) Comp -3

File 2:
FieldA FieldB Field2 Field3 FieldC
1-6 7-26 27-30 31-34 35-41
100 200 1100 1200 1234
102 202 2100 2200 1111

FieldA : 1-6 PIC(x)
FieldB : 7-26 PIC(x)
Field2 : 27-30 S9(9) Comp
Field3 : 31-34 S9(9) Comp
FieldC : 35-41 S9(12) Comp - 3


Output file:

FieldB FieldC Field2 Field3
1-20 21-32 33-41 42-50
200 1234 1100 1200
201 1234
202 1111 2100 2200


FieldB : 1-20 PIC(X)
FieldC : 21-32 9(12)
Field2 : 33-41 9(9)
Field3 : 42-50 9(9)
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Mar 27, 2007 11:17 am    Post subject: Reply with quote

aruna,

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 DSN=...  input file1 (FB/33)
//IN2 DD DSN=...  input file2 (FB/41)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/50)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(51,6,CH) ON(1,20,CH) -
  WITH(33,9) WITH(42,9) KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1:7,20,
    21:27,7,PD,TO=ZD,LENGTH=12,
    51:1,6)
/*
//CTL2CNTL DD *
  INREC BUILD=(1:7,20,
    33:27,4,BI,TO=ZD,LENGTH=9,
    42:31,4,BI,TO=ZD,LENGTH=9,
    51:1,6)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,50)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aruna_space
Beginner


Joined: 13 Mar 2007
Posts: 15
Topics: 5

PostPosted: Thu Mar 29, 2007 10:21 pm    Post subject: Reply with quote

Thanks a ton Frank Smile

It works fine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group