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

Sort JCL Help Needed to compare and delete between two files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Wed Feb 08, 2012 4:50 am
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 Developer


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

PostPosted: Wed Feb 08, 2012 5:10 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 5:31 am
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: 1702
Location: Australia

PostPosted: Wed Feb 08, 2012 5:34 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 5:54 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 5:56 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 6:08 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Feb 08, 2012 6:14 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 6:16 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 08, 2012 6:22 am
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 Developer


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

PostPosted: Wed Feb 08, 2012 6:41 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 6:43 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 7:14 am
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: 1702
Location: Australia

PostPosted: Wed Feb 08, 2012 7:17 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 7:34 am
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: 1702
Location: Australia

PostPosted: Wed Feb 08, 2012 9:34 am
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: 51
Location: India

PostPosted: Wed Feb 08, 2012 9:36 am
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: 51
Location: India

PostPosted: Thu Feb 09, 2012 1:55 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 09, 2012 4:26 am
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: 51
Location: India

PostPosted: Thu Feb 09, 2012 4:33 am
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
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Feb 09, 2012 4:35 am
Reply with quote

stop polluting the forum with duplicate requests . You are now officially warned !

where do You want to continue the discussion about the last request, here or ...

here www.ibmmainframes.com/viewtopic.php?t=57459&highlight=

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

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Thu Feb 09, 2012 8:16 am
Reply with quote

Please continue here
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Sat Feb 18, 2012 12:00 pm
Reply with quote

I was trying to Sort two PS file with VB record having Lrecl 3313 , Using Joinkeys to identify Matched records and Unmatched record from file

If i try with 20 records its working fine , the same sortcard if i try for 70000 records its giving

SYSTEM COMPLETION CODE=0C4 REASON CODE=00000004

Sort card used is

Code:
 JOINKEYS FILES=F1,FIELDS=(5,1000,A)                     
 JOINKEYS FILES=F2,FIELDS=(5,1000,A)                     
 JOIN UNPAIRED,F1                                       
 REFORMAT FIELDS=(F1:1,3313,F2:1,3313),FILL=X'FF'       
 OPTION COPY                                             
 OUTFIL FNAMES=NOMATCH1,                                 
 INCLUDE=(3318,1,CH,EQ,X'FF'),                           
 OUTREC=(05,3309),FTOV,VLTRIM=X'FF'                     
  OUTFIL FNAMES=MATCHES,                                 
   INCLUDE=(3318,1,CH,NE,X'FF',AND,3318,1,CH,NE,X'FF'), 
   OUTREC=(05,3309),FTOV,VLTRIM=X'FF'                   

Could you some one please help me to resolve soc4 abend
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Feb 18, 2012 3:01 pm
Reply with quote

Do you have any records on your file which are shorter than 1000 bytes?

Do you have records of different types that you shouldn't be including, in general, not related to the abend.
Back to top
View user's profile Send private message
raj4neo
Warnings : 1

New User


Joined: 12 May 2006
Posts: 51
Location: India

PostPosted: Sat Feb 18, 2012 3:15 pm
Reply with quote

no all the records greater than 1000

i tried using PARM='MAXSORT,FILSZ=E20M,MINWKSP=60'
but i got error as

WER479A MAXSORT MAY NOT BE USED IN A JOIN APPLICATION


I got the errors as SRTMAT - ABEND=S000 U0016 REASON=00000000
sometimes

UNSUCCESSFUL SORT 0C4 S
SYSTEM COMPLETION CODE=0C4 REASON CODE=00000004

Please help me to resolve
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 9
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top