MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get the matching records from 2 diferent files
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Dec 16, 2004 7:43 am    Post subject: Reply with quote

Also, make sure none of the input files have a duplicate 3456789012 record. The above code does not support duplicate entry in the same file.

Thanks,
Phantom
Back to top
View user's profile Send private message
e_thani
Beginner


Joined: 26 Jul 2004
Posts: 4
Topics: 1

PostPosted: Thu Dec 16, 2004 8:10 am    Post subject: Reply with quote

Hi

Here is my jcl
Code:

//TSOTEKA2 JOB (ACCOUNT),CLASS=R,MSGCLASS=X,NOTIFY=&SYSUID,
//STEP0100 EXEC PGM=SYNCTOOL                               
//*                                                       
//TOOLMSG   DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//IN1       DD *                                           
1234567890                                                 
2345678901                                                 
3456789012                                                 
4567890123                                                 
5678901234                                                 
6789012345                                                 
//*                                                       
//IN2       DD *                                           
3456789012                                                 
7890123456                                                 
8901234567                                                 
//*                                                       
//T1        DD DSN=&T1,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
//T2        DD DSN=&T2,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
//INT       DD DSN=*.T1,DISP=(OLD,PASS),VOL=REF=*.T1             
//          DD DSN=*.T2,DISP=(OLD,PASS),VOL=REF=*.T2             
//FILEA     DD SYSOUT=*                                         
//FILEB     DD SYSOUT=*                                         
//OUT       DD SYSOUT=*                                         
//TOOLIN    DD   *                                               
  SORT FROM(IN1) USING(CTL1)                                     
  SORT FROM(IN2) USING(CTL2)                                     
  SORT FROM(INT) USING(CTL3)                                     
//CTL1CNTL  DD *                                                 
  SORT FIELDS=(1,9,CH,A)                                         
  OUTFIL FNAMES=T1,OUTREC=(1,80,C'1')                             
//CTL2CNTL  DD   *                                               
  SORT FIELDS=(1,9,CH,A)                                         
  OUTFIL FNAMES=T2,OUTREC=(1,80,C'2')                             
//CTL3CNTL  DD   *                                               
  SORT FIELDS=(1,10,CH,A)                                       
  SUM FIELDS=(81,1,ZD)                                           
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80)         
  OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80)   
  OUTFIL FNAMES=FILEB,INCLUDE=(81,1,CH,EQ,C'2'),OUTREC=(1,80)   
/*
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Dec 16, 2004 8:24 am    Post subject: Reply with quote

e thani,

Please post your correct JCL. The JCL you have given will work absolutely fine. Just post your CTL3CNTL.

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Dec 16, 2004 8:27 am    Post subject: Reply with quote

E_thani,

The JCL works fine. Please post your DFSMSG sysout messages here.

Thanks

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
e_thani
Beginner


Joined: 26 Jul 2004
Posts: 4
Topics: 1

PostPosted: Mon Dec 20, 2004 5:04 am    Post subject: Reply with quote

SYNCSORT 3.7DRI TPF3A US PATENTS: 4210961,5117495, OTHER PAT. PEND. (C) 1998 S
* PERSHING LLC. * z/OS 1.4.0 CPU MODEL 2
CTL1CNTL :
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OUTREC=(1,80,C'1')
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN1,SORTDD=CTL1,DYNALLOC
WER038I WARNING: SYNCSORT MVS IS NOT CERTIFIED TO RUN ON Z/OS. CONTACT SYNCSOR
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER164B 12,808K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 12,268K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I IN1 : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I T1 : RECFM=FB ; LRECL= 81; BLKSIZE= 27945
WER410B 11,780K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 11,776K BYTES USED
WER036B G=25957,B=674
WER162B 0 PREALLOCATED SORTWORK TRACKS, 240 DYNAMICALLY ALLOCATED,
WER162B 0 ACQUIRED IN SECONDARY EXTENTS, 0 RELEASED, TOTAL OF 1 TRACKS USED
WER045C END SORT PHASE
WER405I T1 : DATA RECORDS OUT 6; TOTAL RECORDS OUT 6
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR IN1
WER416B OUTFIL WAS USED FOR CTL1OUT
WER416B CTL1WK01: EXCP'S=5,UNIT=3390,DEV=952D,CHP=2FB42E6DB56F6E6C,VOL=TPUB50
WER416B TOTAL OF 5 EXCP'S ISSUED FOR SORTWORKS
WER246I FILESIZE 480 BYTES
WER054I RCD IN 6, OUT 6
WER169I RELEASE 3.7D BATCH 0366 TPF LEVEL 3A
WER052I END SYNCSORT - TSOTEKA2,STEP0100,,DIAG=E800,ACD8,02D4,24BD,E9D6,ACC9,0
SYNCSORT 3.7DRI TPF3A US PATENTS: 4210961,5117495, OTHER PAT. PEND. (C) 1998 S
* PERSHING LLC. * z/OS 1.4.0 CPU MODEL 2
CTL2CNTL :
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T2,OUTREC=(1,80,C'2')
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN2,SORTDD=CTL2,DYNALLOC
WER038I WARNING: SYNCSORT MVS IS NOT CERTIFIED TO RUN ON Z/OS. CONTACT SYNCSO
WER428I CALLER-PROVIDED IDENTIFIER IS "0002"
WER164B 12,808K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 12,268K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I IN2 : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I T2 : RECFM=FB ; LRECL= 81; BLKSIZE= 27945
WER410B 11,780K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 11,776K BYTES USED
WER036B G=25957,B=674
WER162B 0 PREALLOCATED SORTWORK TRACKS, 240 DYNAMICALLY ALLOCATED,
WER162B 0 ACQUIRED IN SECONDARY EXTENTS, 0 RELEASED, TOTAL OF 1 TRACKS USE
WER045C END SORT PHASE
WER405I T2 : DATA RECORDS OUT 3; TOTAL RECORDS OUT 3
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR IN2
WER416B OUTFIL WAS USED FOR CTL2OUT
WER416B CTL2WK01: EXCP'S=5,UNIT=3390,DEV=9537,CHP=2FB42E6DB56F6E6C,VOL=TPUB6
WER416B TOTAL OF 5 EXCP'S ISSUED FOR SORTWORKS
WER246I FILESIZE 240 BYTES
WER054I RCD IN 3, OUT 3
WER169I RELEASE 3.7D BATCH 0366 TPF LEVEL 3A
WER052I END SYNCSORT - TSOTEKA2,STEP0100,,DIAG=E200,A696,08D4,68B7,E3D6,A687,
SYNCSORT 3.7DRI TPF3A US PATENTS: 4210961,5117495, OTHER PAT. PEND. (C) 1998
* PERSHING LLC. * z/OS 1.4.0 CPU MODEL
CTL3CNTL :
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(81,1,ZD)
OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80)
OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80)
OUTFIL FNAMES=FILEB,INCLUDE=(81,1,CH,EQ,C'2'),OUTREC=(1,80)
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=INT,SORTDD=CTL3,DYNALLOC
WER038I WARNING: SYNCSORT MVS IS NOT CERTIFIED TO RUN ON Z/OS. CONTACT SYNCSO
WER428I CALLER-PROVIDED IDENTIFIER IS "0003"
WER164B 20,460K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 20,240K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I INT : RECFM=FB ; LRECL= 81; BLKSIZE= 27945
WER110I OUT : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I FILEA : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I FILEB : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER410B 19,432K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 19,428K BYTES USED
WER036B G=721,B=626
WER045C END SORT PHASE
WER055I INSERT 0, DELETE 1
WER418I DATASPACE(S) AND/OR HIPERSPACE(S) USED
WER405I OUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER405I OUT : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER405I FILEA : DATA RECORDS OUT 5; TOTAL RECORDS OUT 5
WER405I FILEB : DATA RECORDS OUT 2; TOTAL RECORDS OUT 2
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER416B INT: EXCP'S=2,UNIT=3390,DEV=9537,CHP=2FB42E6DB56F6E6C,VOL=TPUB6
WER416B OUTFIL WAS USED FOR CTL3OUT
WER246I FILESIZE 729 BYTES
WER054I RCD IN 9, OUT 8
WER169I RELEASE 3.7D BATCH 0366 TPF LEVEL 3A
WER052I END SYNCSORT - TSOTEKA2,STEP0100,,DIAG=C700,064D,28D4,A006,C6C6,064D,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Dec 20, 2004 6:17 am    Post subject: Reply with quote

e_thani,

I think you need to add the OPTION EUQALS parm on CTL3CNTL.

Code:

//CTL3CNTL  DD   *                                             
  OPTION EQUALS
  SORT FIELDS=(1,10,CH,A)                                       
  SUM FIELDS=(81,1,ZD)                                         
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80)       
  OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80)   
  OUTFIL FNAMES=FILEB,INCLUDE=(81,1,CH,EQ,C'2'),OUTREC=(1,80)
/*


Re run the job now with this control card and see if it works

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
whizkid79
Beginner


Joined: 29 Sep 2004
Posts: 53
Topics: 14

PostPosted: Tue Dec 21, 2004 2:09 pm    Post subject: Reply with quote

Hi,

Where can i get a good help manual on EASYTRIEVE?

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Dec 21, 2004 3:56 pm    Post subject: Reply with quote

whizkid79 ,

Did you check the mainpage of mvsforums?

www.mvsforums.com

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dhulipalla
Beginner


Joined: 24 Aug 2004
Posts: 21
Topics: 6

PostPosted: Sun Nov 20, 2005 7:30 pm    Post subject: Reply with quote

Kolusu,


There are 2 files file1 and file2, both are having the same layout.

Code:

HEADER
FIELD1         X VALUE '1'
FIELD2         X(6) VALUE 'HDRABC'
FIELD3         X(10) VALUE 'YYYY-MM-DD'
FIELD4         X(05)
FIELD5         X(06)

DETAIL
FIELDA         X(5)
FIELDB         X(6)
total             X(16)

TRAILER RECORD

FIELDT1       X VALUE '5'
FIELDT2       X(6) VALUE 'TRLXYZ'
FIELDT3       X(10)
total            X(16)

Output file

FIELDA        X(5) FROM THE DETAIL RECORD
TOTAL         X(16) FROM THE DETAIL RECORD


I need to do the file matching in the COBOL
- write all the records from the file1 which are not there in file2
- write all the records from the file2 which are not there in file1
- if the key(FIELDA in the detail record) matches in file1,file2 then there should be only one record in the output file with the summation of the total(DETAIL RECORD) of file1 and file2.
- TOTAL of trailer record is the total of all the detail records. I need to check whether total of all the detail records are matching with the total of trailer record's total in each file.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sun Nov 20, 2005 7:38 pm    Post subject: Reply with quote

Dhulipala,


    1. Sort both files on the first 5 bytes. Make sure that the header and trailer stays as is.

    2. Use the cobol logic in the first post of this topic

    3. Declare 3 working storage variables.

    a. variable to hold the total for matching keys
    b. variable to hold the running total of all records in file1.
    c. variable to hold the running total of all records in file2.


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dhulipalla
Beginner


Joined: 24 Aug 2004
Posts: 21
Topics: 6

PostPosted: Sun Nov 20, 2005 7:49 pm    Post subject: Reply with quote

Kolusu,

I handled that part and I am new to writing a program which handles Header and Trailer..In other terms how can I validate the Header and Trailer while reading?
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Nov 21, 2005 12:15 am    Post subject: Reply with quote

dhulipalla,

Quote:

In other terms how can I validate the Header and Trailer while reading?


Are you referring to this ???
Code:

1. Sort both files on the first 5 bytes. Make sure that the header and trailer stays as is.


If you are having problems sorting the detail records alone, keeping the header and trailer intact, then check out the links below.
http://mvsforums.com/helpboards/viewtopic.php?t=3432
http://mvsforums.com/helpboards/viewtopic.php?t=1850&highlight=sort+header+sorting+detail
http://mvsforums.com/helpboards/viewtopic.php?t=3479&highlight=sort+header+sorting+detail
http://mvsforums.com/helpboards/viewtopic.php?t=2880&highlight=sort+header+sorting+detail
http://mvsforums.com/helpboards/viewtopic.php?t=2795&highlight=sort+header+sorting+detail

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
pradeepg
Beginner


Joined: 06 Jan 2003
Posts: 25
Topics: 12
Location: Columbus, OH

PostPosted: Thu Dec 01, 2005 3:07 pm    Post subject: SUM FIELDS - What is the maximum length it can accept Reply with quote

Hi Kolusu,

Thanks for positng this solution. It is really helpful.
I would like to use this code to compare the data in DB2 environments.
But my SORT FIELDS key would be the entire table length (cumulative of all column lengths). Is there a maximum limiit to this option.
one of our table has a length of 6000, I want to compare the entire length. Can I do it.

Thanks,
Pradeep
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Dec 01, 2005 3:20 pm    Post subject: Reply with quote

Quote:

But my SORT FIELDS key would be the entire table length (cumulative of all column lengths). Is there a maximum limiit to this option.
one of our table has a length of 6000, I want to compare the entire length. Can I do it.


pradeepg,

There is limit and it is 4092.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
waitling
Beginner


Joined: 12 Dec 2006
Posts: 15
Topics: 3

PostPosted: Thu Dec 14, 2006 7:37 am    Post subject: Reply with quote

kolusu

I have no idea about many to many matching,can it be accomplished by jcl?

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group