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

Insert records from file1 to file2 and vice-versa


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

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Feb 14, 2007 5:50 pm
Reply with quote

Hi,

I have two flat files with following attributes and layout (similar for both)-

lrecl=128
recfm=fb
Layout:
01 main-var.
03 key pic X(11).
03 remianing pic (117).

My requirement is verify both the files and insert the missing records in the other file (from file1 to file2 and vice versa).


Note : Both the files contain unique records

Ex:
Before running the job -

Code:

File 1 -
---------------------------
key       remaining
---------------------------
A         XXXXXXXX
B         XXXXXXXX
D         XXXXXXXX
-------------------------


Code:

File 2 -
---------------------------
key       remaining
---------------------------
C         XXXXXXXX
E         XXXXXXXX
A         XXXXXXXX
----------------------------


After running the job (order is not problem i.e., OP file could be in sorted/random order)

Since C& E records are missing from file1, my file should look like

Code:

File 1 -
---------------------------
key       remaining
---------------------------
A         XXXXXXXX
B         XXXXXXXX
D         XXXXXXXX
C         ALL ZEROES
E         ALL ZEROES
------------------------


Since B & D are missing from FILE2, it should look like -

Code:

---------------------------
key       remaining
---------------------------
C         XXXXXXXX
E         XXXXXXXX
A         XXXXXXXX
B         ALL ZEROES
D         ALL ZEROES
----------------------------


Can this be achevied in DFSORT?

Regards,
Murali
Back to top
View user's profile Send private message
tirumalg

New User


Joined: 14 Feb 2007
Posts: 6
Location: Bangalore, INDIA

PostPosted: Wed Feb 14, 2007 6:05 pm
Reply with quote

Murali,

To my knowledge this cannot be achived by DFSORT. You have to go for simple COBOL/REXX program.
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 Feb 14, 2007 9:48 pm
Reply with quote

tirumalg,

Your knowledge is faulty. This can indeed be achieved by DFSORT/ICETOOL.

Murali,

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/128)
//IN2 DD DSN=...  input file2 (FB/128)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT2 DD DSN=&&O2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SELECT FROM(T1) TO(OUT1) ON(1,11,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(129:C'1')
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=OUT1,BUILD=(1,128)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(129:C'2')
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=OUT2,BUILD=(1,128)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(129,1,CH,EQ,C'2'),
    BUILD=(1,11,117C'0')
  OUTFIL FNAMES=OUT2,INCLUDE=(129,1,CH,EQ,C'1'),
    BUILD=(1,11,117C'0')
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Feb 15, 2007 4:32 pm
Reply with quote

Thanks Frank. You made my job very easy.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top