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

JCL to find records of a file not present in another file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jun 02, 2011 11:22 pm
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: 8797
Location: Welsh Wales

PostPosted: Thu Jun 02, 2011 11:37 pm
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 Developer


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

PostPosted: Fri Jun 03, 2011 12:51 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top