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
 

 

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: 2429
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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