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
 
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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm

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