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 

Matching records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Wed Oct 20, 2004 8:56 pm    Post subject: Matching records Reply with quote

Hi,

I have two files as follows both FB, length 80 and Ouput file is also of same attribute as input:

File 1:

11111111
33333333

File 2:
11111111 AA
11111111 BB
22222222 AA
22222222 BB
33333333 AA
33333333 BB
33333333 CC
44444444 AA

Output File :
11111111 AA
11111111 BB
33333333 AA
33333333 BB
33333333 CC

I need to extract the records from File 2 based on the matching first 8 bytes of File 1 and File 2 and write to output file.

Is it possible to do it using DFSORT or ICETOOL.

I really appreciate any help on this.

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


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

PostPosted: Wed Oct 20, 2004 9:30 pm    Post subject: Reply with quote

Maheswari,

Please search before posting. check the following links


http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=match

http://www.mvsforums.com/helpboards/viewtopic.php?t=1269&highlight=match

http://www.mvsforums.com/helpboards/viewtopic.php?t=1081&highlight=match

Since your input has duplicates , check the solutions posted in the following links using DFSORT's SPLICE operator


http://www.mvsforums.com/helpboards/viewtopic.php?t=2771&highlight=splice

http://www.mvsforums.com/helpboards/viewtopic.php?t=2211&highlight=splice

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
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Wed Oct 20, 2004 11:08 pm    Post subject: Reply with quote

Hi kolusu,

I looked into above postings and have faced the problem because of duplicates. I will try again with SPLICE as explained in one of the post above.

Thanks for your help.
_________________
Amit
Back to top
View user's profile Send private message
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Sat Oct 23, 2004 7:43 pm    Post subject: Reply with quote

Hi Kolusu,

I have tried the above using SPLICE and was successesful, but when using temporary DSN T1, T2, T3 and T4, and later concating it and using SPLICE in the control card, I am always getting OPEN error for DDNAME CONCT.

I tried using the datsets by preallocating them and I was able to see the actual results.

I am pasting the error message from DFSMSG
Code:

0            OUTFIL FNAMES=OUT,                                               
               INCLUDE=((2019,2,CH,EQ,C'X2'),OR,                               
                        (2019,2,CH,EQ,C'12')),                                 
               OUTREC=(1,2020)                                                 
 ICE146I 0 END OF STATEMENTS FROM CTL4CNTL - PARAMETER LIST STATEMENTS FOLLOW 
           DEBUG NOABEND,ESTAE                                                 
           OPTION LIST,MSGPRT=ALL,MSGDDN=DFSMSG,RESINV=0,SORTDD=CTL4,SORTIN=CON
                          RTOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,
                          HECK                                                 
           SORT FIELDS=(21,8,CH,A)                                             
           MODS E35=(ICE35DU,8192)                                             
 ICE063A 2 OPEN ERROR CON                                                     
 ICE052I 3 END OF DFSORT                                                       

Can you please let me know the reason for this. I tried lot to get the reason for this but not able to get the same.

Thanks
_________________
Amit
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sun Oct 24, 2004 1:12 pm    Post subject: Reply with quote

The OPEN error from DFSORT/ICETOOL means that the RECFM or LRECL from the files you concatenated was incompatible in some way (e.g. different LRECLs for RECFM=FB concatenated files). That usually means that the operators you used to set up the files you want to concatenate did not set them all up to have the same LRECL. Using the same n:X in the OUTREC statement or parameter for all of the output files to be concatenated as input can usually take care of this.

If you want help figuring out what's wrong exactly, you need to post the DFSORT/ICETOOL JCL and control statements.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Mon Oct 25, 2004 9:26 pm    Post subject: Reply with quote

Hi Frank,

I am attaching the job below.
File 1, 2018 byte length, FB Key to be matched at position 21
File 2, 2018 byte length, FB key to be matched at position 1
Code:

//S1      EXEC  PGM=ICETOOL                                         
//TOOLMSG DD  SYSOUT=*                                             
//DFSMSG  DD  SYSOUT=*                                             
//IN1     DD DSN=   File 1,DISP=SHR   
//IN2     DD DSN=File 2,DISP=SHR                         
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T2      DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T3      DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T4      DD DSN=&&T4,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//CON     DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)                 
//        DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)                 
//        DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,PASS)                 
//OUT     DD DSN=Out put File,DISP=SHR         
//TOOLIN  DD *                                                     
  COPY FROM(IN2) TO(T4) USING(CTL5)                                 
  COPY FROM(T4) TO(T1) USING(CTL1)                                 
  SELECT FROM(IN1) TO(T2) ON(21,8,CH) FIRSTDUP USING(CTL2)         
  COPY FROM(IN1) TO(T3) USING(CTL3)                                 
  SPLICE FROM(CON) TO(OUT) ON(21,8,CH)  -                   
    WITHALL WITH(1,2019) USING(CTL4)                       
/*                                                         
//CTL1CNTL DD *                                             
  OUTREC FIELDS=(1,2018,2019:C'22')                         
/*                                                         
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=(T2),OUTREC=(1,2018,2019:C'XX')             
/*                                                         
//CTL3CNTL DD *                                             
  OUTREC FIELDS=(1,2018,2019:C'11')                         
/*                                                         
//CTL4CNTL DD *                                             
  OUTFIL FNAMES=OUT,                                       
    INCLUDE=((2019,2,CH,EQ,C'X2'),OR,                       
             (2019,2,CH,EQ,C'12')),                         
    OUTREC=(1,2020)                                         
//CTL5CNTL DD *                                             
 OUTREC FIELDS=(21:1,8,2020:X)                             
/*

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


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

PostPosted: Mon Oct 25, 2004 10:21 pm    Post subject: Reply with quote

Maheswari,

Change your allocation to the following.

Code:

//T1      DD DSN=&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T2      DD DSN=&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T3      DD DSN=&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//T4      DD DSN=&T4,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)     
//CON     DD DSN=&T1,VOL=REF=*.T1,DISP=(OLD,PASS)                 
//        DD DSN=&T2,VOL=REF=*.T2,DISP=(OLD,PASS)                 
//        DD DSN=&T3,VOL=REF=*.T3,DISP=(OLD,PASS) 


Note the single ampersands in the dsn names

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
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Mon Oct 25, 2004 10:50 pm    Post subject: Reply with quote

Hi Kolusu,

Still the same error message. I had used double && in my few jobs earlier and they worked perfectly.
_________________
Amit
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 26, 2004 10:44 am    Post subject: Reply with quote

Maheswari,

I get a return code of zero running your job. post the complete DFSMSG & TOOLMSG's

KOlusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Oct 26, 2004 10:44 am    Post subject: Reply with quote

Amit,

When I ran your job, it ran successfully - it did not get the OPEN error. But your job doesn't actually do what you want it to do.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1      EXEC  PGM=ICETOOL
//TOOLMSG DD  SYSOUT=*
//DFSMSG  DD  SYSOUT=*
//IN1     DD DSN=...  input file1
//IN2     DD DSN=...  input file2
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2      DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON     DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//        DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT     DD DSN=...  output file
//TOOLIN  DD *
*                          2018
* IN1->T1:  |21,8|blanks      |11|
  COPY FROM(IN1) TO(T1) USING(CTL1)
*                          2018
* IN2->T2:  |1,2018           |22|
  COPY FROM(IN2) TO(T2) USING(CTL2)
* T1/T2->OUT:  SPLICE on 1,8,CH.  Get 1-2019 from overlay
* record and 2020 from base record.
* Remove spliced records with '22' id - these are file2
* dup records without a match in file1.
* Remove the id.
  SPLICE FROM(CON) TO(OUT) ON(1,8,CH) WITHALL -
    WITH(1,2019) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(21,8,2019:C'11')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,2018,2019:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(2019,2,CH,EQ,C'22'),
    OUTREC=(1,2018)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Tue Oct 26, 2004 4:32 pm    Post subject: Reply with quote

Hi Frank,

I am getting the following error message for the above job:

ICE146I 0 END OF STATEMENTS FROM CTL3CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION LIST,MSGPRT=ALL,MSGDDN=DFSMSG,RESINV=0,SORTDD=CTL3,SORTIN=CON,
RTOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,N
HECK
SORT FIELDS=(1,8,CH,A)
MODS E35=(ICE35DU,8192)
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 9 END OF OUT FIELD BEYOND MAXIMUM RECORD LENGTH
ICE052I 3 END OF DFSORT

I was able to get the results when I used used the datasets instead of Temporary datasets in the above job posted.
_________________
Amit
Back to top
View user's profile Send private message
Maheshwari
Beginner


Joined: 19 Oct 2004
Posts: 21
Topics: 3

PostPosted: Tue Oct 26, 2004 4:42 pm    Post subject: Reply with quote

Hi Frank and Kolusu,

Thanks for your help. The reason was mismatch in the output file created. I was able to sort out the things.

Thanks again for all your help extended to me.
_________________
Amit
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 Oct 28, 2004 11:45 am    Post subject: Reply with quote

Kolusu,

Quote:

Note the single ampersands in the dsn names


I never realized this....Is there any difference b/w using double && and using single & to create a temp dataset ?

I ran 2 job using one using single & and other using double &, and both jobs ran fine.

Thanks,
Phantom
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
Page 1 of 1

 
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