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 

Extract records from File2 depending on File1

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


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Sep 27, 2007 2:38 pm    Post subject: Extract records from File2 depending on File1 Reply with quote

Hi,

This might be pretty simple for some of you. I had done it in past but need it in a hurry now. Can somebody please help me.

File1 (FB):

Code:
00100001000010010
44444444444444444
23423452345232345


file2 (VSAM):

Code:
24523423423423423 asdfasf adflasdkfjl kdfjald kfja
23423452352352355 adkfj akldfjasldkfj lakdjfalksdf
44444444444444444 asdfsdfsdf  dfasdf asdfsdf sffff
...
...


What I need is to extract the records from File2 if the first 17 bytes of File2 matches with any of the first 17 bytes from File1

Output should be:

Code:
44444444444444444 asdfsdfsdf  dfasdf asdfsdf sffff



Thanks a lot.
_________________
Thanks.
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: Thu Sep 27, 2007 2:56 pm    Post subject: Reply with quote

You can use a DFSORT/ICETOOL job like this to do what you asked for. I assumed neither input file has duplicates within it. I also assumed that both files have 80 byte fixed-length records, but you can change the job appropriately for other record lengths.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  seq input file (FB/80)
//IN2 DD DSN=...  VSAM input file (80 byte records)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  seq output file (FB/80)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2) VSAMTYPE(F)
SELECT FROM(T1) TO(OUT) ON(1,17,CH) ALLDUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'2'),
    BUILD=(1,80)
/*

_________________
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
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Sep 27, 2007 3:03 pm    Post subject: Reply with quote

Thanks a lot Frank. My Input file PS is 17 bytes and output file VSAM 1053 bytes. Does that mean, I need to create the input file first to 1053 bytes and then perform the above processing ?

Thanks again.
_________________
Thanks.
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Sep 27, 2007 3:04 pm    Post subject: Reply with quote

Oh, I am sorry. My first input file is 17 bytes and another input files is 1053 bytes. Sorry for the typo.
_________________
Thanks.
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Thu Sep 27, 2007 4:26 pm    Post subject: Reply with quote

Now, I have converted both the input files to equal length of 18 bytes of which first 17 bytes are to be compared.

I am using below but am getting message : Field beyond maximum Record length.

Code:

//TOOLIN   DD *                                                         
 COPY FROM(IN1) TO(T1) USING(CTL1)                                     
 COPY FROM(IN2) TO(T1) USING(CTL2)                                     
 SELECT FROM(T1) TO(OUT) ON(1,17,CH) ALLDUPS USING(CTL3)               
/*                                                                     
//CTL1CNTL DD *                                                         
 INREC OVERLAY=(19:C'1')                                               
/*                                                                     
//CTL2CNTL DD *                                                         
 INREC OVERLAY=(19:C'2')                                               
/*                                                                     
//CTL3CNTL DD *                                                         
 OUTFIL FNAMES=OUT,INCLUDE=(19,1,CH,EQ,C'2'),                           
 BUILD=(1,18)                                                           
/*

_________________
Thanks.
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: Fri Sep 28, 2007 10:25 am    Post subject: Reply with quote

I tried your JCL with input files having RECFM=FB and LRECL=18 and got cc=0. If your input files have RECFM=FB and LRECL=18, then you shouldn't get that message, so there's something you're not aware of or not telling me.

Please post your complete JCL and control statements, and all of the //TOOLMSG and //DFSMSG messages.
_________________
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
mvs
Beginner


Joined: 08 Aug 2007
Posts: 3
Topics: 0

PostPosted: Fri Sep 28, 2007 11:53 am    Post subject: Reply with quote

Try "OPTION SOLRF". My guess is that your installtion default is NOSOLRF. NOSLRF causes the output record length of the first 2 sorts to be 18, not 19, and would cause the ICE027A.
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: Fri Sep 28, 2007 12:05 pm    Post subject: Reply with quote

mvs,

Excellent guess! NOSOLRF would indeed cause the ICE027A message. I always forget about NOSOLRF since SOLRF is the shipped default and highly recommended value.

seekaysk,

Look for the following in the DFSMSG messages:

Code:

ICE133I 0 OPTIONS:  ...,SOLRF=x,...


If x is N, you have NOSOLRF in effect. If x is Y, you have SOLRF in effect. If your System Programmers changed the shipped default from SOLRF=YES to SOLRF=NO, you might want to ask them why they did that as it can cause some very unexpected results.

SOLRF can be specified for all of the ICETOOL operators with:

Code:

//DFSPARM DD *
  OPTION SOLRF
/*

_________________
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


Last edited by Frank Yaeger on Fri Sep 28, 2007 12:21 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mvs
Beginner


Joined: 08 Aug 2007
Posts: 3
Topics: 0

PostPosted: Fri Sep 28, 2007 12:11 pm    Post subject: Reply with quote

Happy to help, Frank. Even for DFSORT users. (By the way, this problem will not occur with SyncSort, which always passes through the INREC/OUTREC record lengths to SORTOUT.)

Mike Rossini
SyncSort Inc.
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: Fri Sep 28, 2007 12:23 pm    Post subject: Reply with quote

This problem will not occur for DFSORT either unless the site chooses to change the shipped default which is NOT recommended. Some sites do prefer not to have INREC/OUTREC change the SORTOUT record length - not sure why but DFSORT gives them that option if they want it. Unfortunately, those sites don't always inform their users of the change and its effects.
_________________
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
mvs
Beginner


Joined: 08 Aug 2007
Posts: 3
Topics: 0

PostPosted: Fri Sep 28, 2007 12:38 pm    Post subject: Reply with quote

I think I can guess why NOSLRF would be the installation default. That WAS how DFSORT determined the output LRECL until Release 14, when SOLRF was introduced and made the default, adapting the SyncSort algorithm. Some sysprogs would be fearful of this change and thus would choose NOSLRF as their default.

(By the way, DFSORT users converting to SyncSort can have their SyncSort installation customized to use the NOSLRF approach if they choose.)
Back to top
View user's profile Send private message
seekaysk
Beginner


Joined: 31 Aug 2007
Posts: 49
Topics: 15

PostPosted: Fri Sep 28, 2007 1:28 pm    Post subject: Reply with quote

Frank and MVS,

Kudos to you both! I truely appreciate your time and effort in solving the problems.

I have a deadine on my head and am going with a workaround now but will surely look into the sys parm suggested and update you.

Thanks a lot again to both of you.
_________________
Thanks.
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: Fri Sep 28, 2007 2:31 pm    Post subject: Reply with quote

mvs,

If you are going to represent Syncsort on this board and make comments about Syncsort vs DFSORT, then please put your affiliation in your signature line so it will show up in every one of your posts. People on this board have the right to know the affiliations of people making comments for their company. It would also be more appropriate to use your real name as your userid as Alissa and I do rather than the very generic "mvs".

SOLRF=YES became the DFSORT default in July, 2000 via an R14 PTF, so you're talking about some pretty old history here. We actually run into very few sites that change the default to SOLRF=NO. As for who's copying who, we both know that both products copy each other to make migration easier which I'm sure customers appreciate (DFSORT offered SOLRF to make migration easier - Syncsort offered NOSOLRF to make migration easier - there are numerous other examples.)

BTW, the option is "NOSOLRF" as you correctly stated in your first post, not "NOSLRF" as you incorrectly stated several times in your last post.
_________________
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
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