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
 

 

Sort JCL Help Needed to compare and delete between two files
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 4:50 am    Post subject: Sort JCL Help Needed to compare and delete between two files
Reply with quote

I have a requirement to compare two PS Files File 1 and File2 , Both are Fixed length , I need to write the matched record in o/p file and matched should be deleted from the File1

Eg :

File 1 :

111
222
333
444
555

File2

333
777
555

requirement 1:

O/p file should be
333
555

Requirement 2 :
333
555 should be deleted from File1

i have the answer for requirement 1 using Join keys

Is it possible to drop the matched records from file 1

Thanks in advance for your help
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 08, 2012 5:10 am    Post subject:
Reply with quote

Huh?

Requirement 1 is apparently to get just the matching records in File1 (333 and 555).

But I don't understand what you want for requirement 2. You show:

Requirement 2 :
333
555 should be deleted from File1

I have no idea what you mean by that. 333 and 555 are both in input file1 and input file2 so by what rule would you keep 333 but delete 555?

Do you want a second output file with the non-matching records from File 1 (111, 222 and 444) or do you want something else?

Show the output you actually expect for requirement 2 from your example of input file1 and input file2. Explain clearly what you want in the output for each requirement. Do you want to produce two output files (output file1 for requirement 1 and output file2 for requirement 2) in the same run, or do you want something else?
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 5:31 am    Post subject: Frank
Reply with quote

want a second output file with the non-matching records from File 1 (111, 222 and 444) or do you want something else?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 08, 2012 5:34 am    Post subject:
Reply with quote

Hi,

try this job which works with DFSORT:

Code:

//S1       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//IN1      DD *                                                   
111                                                               
222                                                               
333                                                               
444                                                               
555                                                               
//IN2      DD *                                                   
333                                                               
777                                                               
555                                                               
//MATCHES  DD SYSOUT=*                                             
//NOMATCH1 DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  JOINKEYS F1=IN1,FIELDS=(1,3,A)                                   
  JOINKEYS F2=IN2,FIELDS=(1,3,A)                                   
  JOIN UNPAIRED,F1                                                 
  REFORMAT FIELDS=(F1:1,80,?)                                     
  OPTION COPY                                                     
  OUTFIL FNAMES=MATCHES,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(1,80)     
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)   
/*                                                               


Gerry
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 5:54 am    Post subject:
Reply with quote

My file has a record length of 730 ,
Total length of the file is Key
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 5:56 am    Post subject:
Reply with quote

i tried with this

Code:

  JOINKEYS FILES=F1,FIELDS=(1,730,A)                               
  JOINKEYS FILES=F2,FIELDS=(1,730,A)                               
  JOIN UNPAIRED,F1                                                 
  REFORMAT FIELDS=(F1:1,730,800)                                   
  OPTION COPY                                                     
  OUTFIL FNAMES=MATCHES,INCLUDE=(731,1,CH,EQ,C'B'),BUILD=(1,730)   
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(731,1,CH,EQ,C'1'),BUILD=(1,730) 


Its giving ABENDU0016
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 6:08 am    Post subject: i tried with this ,
Reply with quote

Code:

SYSIN :                                                                       
  JOINKEYS FILES=F1,FIELDS=(1,730,A)                                     0024000
  JOINKEYS FILES=F2,FIELDS=(1,730,A)                                     0025000
  JOIN UNPAIRED,F1                                                             
  REFORMAT FIELDS=(F1:1,730)                                             0026000
  OPTION COPY                                                                   
  OUTFIL FNAMES=MATCHES,INCLUDE=(1,730,CH,EQ,C'B'),BUILD=(1,730)         0027100
                                   *                                           
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(1,730,CH,EQ,C'1'),BUILD=(1,730)        0027100
                                    *                                           
 WER251A  INCLUDE/OMIT INVALID LENGTH                                           
 WER251A  INCLUDE/OMIT INVALID LENGTH
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Feb 08, 2012 6:14 am    Post subject: Reply to: Sort JCL Help Needed to compare and delete between
Reply with quote

just take a decision ...

in one post You show
Code:
OUTFIL FNAMES=MATCHES,INCLUDE=(731,1,CH,EQ,C'B'),BUILD=(1,730)
OUTFIL FNAMES=NOMATCH1,INCLUDE=(731,1,CH,EQ,C'1'),BUILD=(1,730)


in the other one
Code:
OUTFIL FNAMES=MATCHES,INCLUDE=(1,730,CH,EQ,C'B'),BUILD=(1,730) 
OUTFIL FNAMES=NOMATCH1,INCLUDE=(1,730,CH,EQ,C'1'),BUILD=(1,730)

You are comparing a 730 bytes long something with a 1 byte someotherthing
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 6:16 am    Post subject:
Reply with quote

I was new to this and i was try with different thing
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Feb 08, 2012 6:22 am    Post subject: Reply to: Sort JCL Help Needed to compare and delete between
Reply with quote

Confirmed as Syncsort anyway.

EDIT:

Gerry was using 80-byte records, with key of length three. Just change the lengths.
Code:

//S1       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//IN1      DD dsn=                                                   
//IN2      DD dsn=                                                   
//MATCHES  DD dsn=
//NOMATCH1 DD dsn=
//SYSIN    DD *                                                   
  JOINKEYS F1=IN1,FIELDS=(1,730,A)                                   
  JOINKEYS F2=IN2,FIELDS=(1,730,A)                                   
  JOIN UNPAIRED,F1                                                 
  REFORMAT FIELDS=(F1:1,730,?)                                     
  OPTION COPY                                                     
  OUTFIL FNAMES=MATCHES,INCLUDE=(731,1,CH,EQ,C'B'),BUILD=(1,730)     
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(731,1,CH,EQ,C'1'),BUILD=(1,730)   
/*                                                               


EDIT AGAIN: And assume it works with your release of Syncsort.
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 08, 2012 6:41 am    Post subject:
Reply with quote

Quote:
And assume it works with your release of Syncsort.


That may be a bad assumption. Although Bill's job works with DFSORT, it will not necessarily work with Syncsort (regardless of the version) because DFSORT supports JOINKEYS functions that Syncsort does NOT support.
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 6:43 am    Post subject: Hi
Reply with quote

Code:

SYNCSORT LICENSED FOR CPU SERIAL NUMBER 1E9D6, MODEL 2817 709       
 SYSIN :                                                             
  JOINKEYS FILES=F1,FIELDS=(1,730,A)                                 
  JOINKEYS FILES=F2,FIELDS=(1,730,A)                                 
  JOIN UNPAIRED,F1                                                   
  REFORMAT FIELDS=(F1:1,730,?)                                       
                            *                                         
  OPTION COPY                                                       
  OUTFIL FNAMES=MATCHES,INCLUDE=(731,1,CH,EQ,C'B'),BUILD=(1,730)     
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(731,1,CH,EQ,C'1'),BUILD=(1,730)   
 WER268A  REFORMAT STATEMENT: SYNTAX ERROR                           


Please some one help me how to resolve this
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 7:14 am    Post subject: Possible in ICETOOL?
Reply with quote

If its Possible in ICETOOL also it will be Great .. Thanks for your support
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 08, 2012 7:17 am    Post subject:
Reply with quote

Hi,

I'm preet sure that SYNCSORT does not have an F1 and F2 indicator, so you can try this

Code:
  JOINKEYS FILE=F1,FIELDS=(1,730,A)                           
  JOINKEYS FILE=F2,FIELDS=(1,730,A)                           
  JOIN UNPAIRED,F1                                           
  REFORMAT FIELDS=(F1:1,730,F2:1,730)                         
  OPTION COPY                                                 
  OUTFIL FNAMES=NOMATCH1,                                     
    INCLUDE=(731,01,CH,EQ,C' '),                             
         OUTREC=(1,730)                                       
  OUTFIL FNAMES=MATCHES,                                     
    INCLUDE=(001,256,CH,EQ,0731,256,CH,&,                     
             256,256,CH,EQ,0987,256,CH,&,                     
             513,218,CH,EQ,1243,218,CH),                     
         OUTREC=(01,730)                                     



Gerry
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 7:34 am    Post subject:
Reply with quote

Gerry ,

I tried with this sort card

Its not writing the matched record in the File

NOMATCH1 : DATA RECORDS OUT 27930; TOTAL RECORDS OUT 27930
MATCHES : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 08, 2012 9:34 am    Post subject:
Reply with quote

Hi,

can you try creating the 2 files with the data you provided above and rerun the job.


Gerry
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Wed Feb 08, 2012 9:36 am    Post subject:
Reply with quote

Gerry , i tried with below

Code:
 JOINKEYS FILES=F1,FIELDS=(1,730,A)                   
 JOINKEYS FILES=F2,FIELDS=(1,730,A)                   
 JOIN UNPAIRED,F1                                     
 REFORMAT FIELDS=(F1:1,730,F2:1,730),FILL=C'$'       
 OPTION COPY                                         
   OUTFIL FNAMES=NOMATCH1,                           
   INCLUDE=(731,01,CH,EQ,C'$'),                       
    OUTREC=(1,730)                                   
  OUTFIL FNAMES=MATCHES,                             
  INCLUDE=(731,1,CH,NE,C'$',AND,731,1,CH,NE,C'$'),   
           OUTREC=(01,730)               

Its working fine , Thanks for your extended support
icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Thu Feb 09, 2012 1:55 am    Post subject: Need Help
Reply with quote

Can some one please help me on with Variable Length file having LRECL of 3313 ,

Both Infiles are having similar variable length of 3313
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Feb 09, 2012 4:26 am    Post subject: Reply to: Sort JCL Help Needed to compare and delete between
Reply with quote

It is possible. Can we have a clue as to what sort of help you want?
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 49
Location: India

PostPosted: Thu Feb 09, 2012 4:33 am    Post subject:
Reply with quote

FILE1 Variable length file 3313
File 2 Variable length file 3313

i need to compare two files and which is having key of 1-1000

Output file 1 : should have matched records
Output file 2: with the non-matching records from File 1
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
Goto page 1, 2, 3  Next
Page 1 of 3

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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