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
 
JCL to find records of a file not present in another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sasanka
Warnings : 1

New User


Joined: 18 Jan 2008
Posts: 34
Location: India

PostPosted: Thu Jun 02, 2011 11:20 pm    Post subject: JCL to find records of a file not present in another file
Reply with quote

I have two input files TEST.INPUT.FILE1 and TEST.INPUT.FILE2.

My requirement is to write a JCL that perform the following

(a) If first 8 bytes of records in file TEST.INPUT.FILE1 is similar to first 8 bytes of any records in file TEST.INPUT.FILE2, write those matched records from file TEST.INPUT.FILE1 to an output file TEST.OUTPUT.FILE1.
(b) If first 8 bytes of records in file TEST.INPUT.FILE1 is not similar to first 8 bytes of any records in file TEST.INPUT.FILE2, write those unmatched records from file TEST.INPUT.FILE1 to an output file TEST.OUTPUT.FILE2.

Contents of TEST.INPUT.FILE1 and TEST.INPUT.FILE2 are as below

TEST.INPUT.FILE1

135-4456|CD
166-7765|AF
166-7765|MG
123-1167|VP
254-5578|AF
115-7899|AP
254-5578|XP
254-5578|IP

TEST.INPUT.FILE2

145-7658|MM
135-4456|CD
778-9865|AQ
778-9865|AQ
123-1167|VP
254-5578|AF
765-9922|AD
254-5578|XP
122-9977|PP
154-0097|AS

Output file should be as below

TEST.OUTPUT.FILE1

123-1167|VP
135-4456|CD
254-5578|AF
254-5578|IP
254-5578|XP


TEST.OUTPUT.FILE2

115-7899|AP
166-7765|AF
166-7765|MG
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2441
Location: Netherlands, Amstelveen

PostPosted: Thu Jun 02, 2011 11:22 pm    Post subject:
Reply with quote

My JCL couldnt do that, especially when i invoked the program IEFBR14.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Jun 02, 2011 11:37 pm    Post subject:
Reply with quote

OK, so you want to use JCL, but which program do you wish the JCL to execute.

Peter, if it's any consolation, my IDCAMS didn't either
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: Fri Jun 03, 2011 12:51 am    Post subject:
Reply with quote

Sasanka,

If you have DFSORT, you can use a DFSORT job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=TEST.INPUT.FILE1,DISP=SHR
//IN2 DD DSN=TEST.INPUT.FILE2,DISP=SHR
//OUT1 DD DSN=TEST.OUTPUT.FILE1,DISP=OLD
//OUT2 DD DSN=TEST.OUTPUT.FILE2,DISP=OLD
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,8,A)
  JOINKEYS F2=IN2,FIELDS=(1,8,A)
  JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,80,?)
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
/*
//JNF2CNTL DD *
  SUM FIELDS=NONE
/*
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

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