Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Insert records from file1 to file2 and vice-versa

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

Senior Member


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

PostPosted: Wed Feb 14, 2007 5:50 pm    Post subject: Insert records from file1 to file2 and vice-versa
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    Post subject: Re: Insert records from file1 to file2 and vice-versa
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 Moderator


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

PostPosted: Wed Feb 14, 2007 9:48 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Thu Feb 15, 2007 4:32 pm    Post subject:
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    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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us