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

COPY INPUT2 BUT OMIT MATCHING RECORDS FOUND IN INPUT1


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kevin Santos

New User


Joined: 27 Jan 2009
Posts: 26
Location: toronto

PostPosted: Fri Feb 06, 2009 8:43 pm
Reply with quote

Frank, again thanks for the assistance. I think I know how this works but in your own words, could you please explain the workings of the stmts.
No rush. I know you're a busy guy constantly juggling and managing your time. btw, You can PM me the answer if you like.

Code:
COPY FROM(IN1) USING(CTL1)                             
COPY FROM(IN2) TO(OUT) USING(CTL2)                     
/*                                                     
//CTL1CNTL  DD *                                       
  OUTFIL FNAMES=CTL2CNTL,REMOVECC,                     
   HEADER1=('  OMIT FORMAT=CH,COND=(1,1,NE,1,1,OR, '), 
   BUILD=(C'  5,44,EQ,C''',1,44,C''',OR, ',80:X),       
   TRAILER1=('  1,1,NE,1,1)')                           
/*                                                     
//IN1       DD *                                       
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 Feb 06, 2009 10:10 pm
Reply with quote

We are trying to create an OMIT statement from the constants in file1 to use against the records in file2.

The OMIT statement should look like this:

Code:

   OMIT FORMAT=CH,COND=(1,1,NE,1,1,OR,
      5,44,EQ,'44-byte constant1...',OR,
      5,44,EQ,'44-byte constant2...',OR,
      ...
      1,1,NE,1,1)


The first COPY operator creates this OMIT statement in the CTL2CNTL data set. It uses an OUTFIL statement in CTL1CNTL to do it as follows:

HEADER1 - creates the first line of the OMIT statement.
BUILD - creates a line for each constant in file1.
TRAILER1 - creates the last line of the OMIT statement.

The second COPY operator uses the OMIT statement in CTL2CNTL against input file2.
Back to top
View user's profile Send private message
Kevin Santos

New User


Joined: 27 Jan 2009
Posts: 26
Location: toronto

PostPosted: Sat Feb 07, 2009 12:39 am
Reply with quote

Thank you. what about 1,1,NE,11 in the header and trailer?
How are records from IN1 written one by one into CTL2?
How are records in IN1 compared to records in CTL2, and matched records filtered out?

As you can tell Im not a heavy SORT user but Im having real interest in this, I should read up on it more. Quite powerful. I can see using it here more often..I'd have to look around our installation & applications that can benefit from this.

Again no rush. Reply whenever you find time.. thanks
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: Sat Feb 07, 2009 12:55 am
Reply with quote

Quote:
Thank you. what about 1,1,NE,11 in the header and trailer?


Those are NOPs to allow the correct syntax to be generated more easily:

Code:

  OMIT FORMAT=CH,COND=(line1,
     line2,
     line3,
     ...
     linen)


It's easier to use a NOP for the first line and last line then to do the coding to put real constants into those lines. So I use 1,1,NE,1,1 for line1 and linen, and the real constants for the other lines. 1,1,NE,1,1 can never be true, so it has no effect on the records omitted - it's a NOP. Just a trick.

Quote:
How are records from IN1 written one by one into CTL2?


HEADER1 writes an output line before the detail lines.
BUILD writes one output line (detail line) for each record in IN1.
TRAILER1 writes an output line after the detail lines.

Quote:
How are records in IN1 compared to records in CTL2, and matched records filtered out?


I assume you mean IN2 here, not IN1. It's the records in IN2 we want to do the compare against - right? For the second COPY operator, USING(CTL2) tells DFSORT to use the DFSORT statements in CTL2CNTL against the input from IN2. CTL2CNTL has the OMIT statement, so the OMIT is evaluated for each IN2 record.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Kevin Santos

New User


Joined: 27 Jan 2009
Posts: 26
Location: toronto

PostPosted: Sat Feb 07, 2009 1:00 am
Reply with quote

that was quick. thanks frank.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top