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
 
SPLICE problem when trying to join 2 files

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

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Wed Oct 10, 2007 8:28 pm    Post subject: SPLICE problem when trying to join 2 files
Reply with quote

Hi all,

I'm trying to join 2 files, but I cannot manage to have the desired result.
Here is what I try to do:

----key----
IN1:

AAAA 4444
BBBB 2222
BBBB 1111
KKKK 3333
AAAA 7777
HHHH 7777
HHHH 1111
EEEE 1111

-key-
IN2:

AAAA DATA1
EEEE DATA2
HHHH DATA3
YYYY DATA4

OUTPUT:

AAAA 4444 DATA1
BBBB 2222
BBBB 1111
KKKK 3333
AAAA 7777 DATA1
HHHH 7777 DATA3
HHHH 1111 DATA3
EEEE 1111 DATA2

In IN1, each record is unique (the whole record is unique key).
In IN2, we have as key a subkey of IN1 key format (4 first chars)

Requirement:
OUTPUT contains all IN1 records, but if an IN1 record has its subkey match the key of IN2, then the DATA field of the matching IN2 record has to be appended to the IN1 OUTPUT record.

I've tried with SPLICE, but it seems no option is adequate (WITHALL, KEEPNODUPS, KEEPBASE) nor copying the files to the temp file in one order or another.
The problem is that key2 is a subkey of key1. If key1 and key2 where the same, then I could do:
1) append IN2 to IN1. SPLICE on key WITHALL.

If I do this with our input files and SPLICING on key2, then records would be lost (aggregation of same subkey in IN1)

Any idea?

Thanks.

Julien
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: Wed Oct 10, 2007 10:23 pm    Post subject:
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 *
AAAA 4444
BBBB 2222
BBBB 1111
KKKK 3333
AAAA 7777
HHHH 7777
HHHH 1111
EEEE 1111
/*
//IN2 DD *
AAAA DATA1
EEEE DATA2
HHHH DATA3
YYYY DATA4
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(1,4,CH) KEEPNODUPS KEEPBASE -
  WITHALL WITH(6,4) WITH(82,9)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,4,11:6,5,81:C'BB',83:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV',83:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OMIT COND=(81,2,CH,EQ,C'BB')
  SORT FIELDS=(83,8,ZD,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
julienloc

New User


Joined: 17 Aug 2007
Posts: 29
Location: Brussels

PostPosted: Thu Oct 11, 2007 3:24 pm    Post subject:
Reply with quote

This works! This was kind of tricky with the 'BB' 'VV'.
I'm impressed with DFSORT again.
Thank you Frank.
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 Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm

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