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

Extract data from Master file in Syncsort


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

New User


Joined: 11 Apr 2010
Posts: 1
Location: USA

PostPosted: Fri Apr 27, 2012 11:44 pm
Reply with quote

Friends

I need to extract data from Master file using some conditions.
The trick part is that, I have to check another file to built the conditions.
Is this possible with Sort? If not, any other alternatives?

Example
Master file
0123 A4F3RR4 S4W2 S4G32
0124 BDEFE23 DS23 G3423
0125 4E2RFG2 G23W G42DG
0126 4E2RFG2 G23W G42DH
0127 3G3F234 G3W2 G2343

Condition file
4E2RFG2


Result should be
0125 4E2RFG2 G23W G42DG
0126 4E2RFG2 G23W G42DH


I sincerely appreciate your help.

Thank you
Krishna
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 Apr 28, 2012 12:20 am
Reply with quote

If you have a single-record file with your selection criteria, it is easy to generate a symbol for the SYMNAMES file in one short step, then use the symbol for selection in the main step.

If you have a search with SYMNAMES, you should find some examples, often with a date for selection.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Apr 30, 2012 10:37 am
Reply with quote

Hello,

Also try the below snippet,

Code:
//STEP01   EXEC  PGM=SORT                                 
//SORTJNF1 DD *                                           
0123 A4F3RR4 S4W2 S4G32                                   
0124 BDEFE23 DS23 G3423                                   
0125 4E2RFG2 G23W G42DG                                   
0126 4E2RFG2 G23W G42DH                                   
0127 3G3F234 G3W2 G2343                                   
//SORTJNF2 DD *                                           
4E2RFG2                                                   
//SORTOUT  DD  SYSOUT=*                                   
//SYSOUT DD SYSOUT=*                                     
//SYSIN DD *                                             
  JOINKEYS FILE=F1,FIELDS=(6,7,A)                         
  JOINKEYS FILE=F2,FIELDS=(1,7,A)                         
  SORT FIELDS=COPY                                       
  REFORMAT FIELDS=(F1:1,80)
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: Mon Apr 30, 2012 2:34 pm
Reply with quote

Or, if you don't want to sort the file, which the JOINKEYS does, you can start with this SYMNAMES-generating example.

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//* change below to your selection file, only first record used if multiples...
//SORTIN   DD *
4E2RFG2
//SORTOUT  DD DSN=&&SYM,UNIT=SYSDA,SPACE=(TRK,1),DISP=(,PASS)
//SYSIN    DD *
 OPTION COPY,STOPAFT=1
 OUTREC FIELDS=(C'COND-FOR-SELECT,''',1,7,C'''',80:X)
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYSMNOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&SYM,DISP=SHR
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
 OPTION COPY
 INCLUDE COND=(6,7,CH,EQ,COND-FOR-SELECT)
//SORTIN   DD *
0123 A4F3RR4 S4W2 S4G32
0124 BDEFE23 DS23 G3423
0125 4E2RFG2 G23W G42DG
0126 4E2RFG2 G23W G42DH
0127 3G3F234 G3W2 G2343


Gives:
Code:

0125 4E2RFG2 G23W G42DG
0126 4E2RFG2 G23W G42DH
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Apr 30, 2012 6:06 pm
Reply with quote

Bill Woodger wrote:
Or, if you don't want to sort the file, which the JOINKEYS does, you can start with this SYMNAMES-generating example.
Not sure if I take the inference correctly or it's because of Monday -- if you mention SORTED with JOINKEYS - it won't sort and assume inputs are in sort order, no?

Okay, if my assumption was wrong - consider Monday was in effect... icon_biggrin.gif
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: Mon Apr 30, 2012 7:21 pm
Reply with quote

With the SYMNAMES the requirement can be satisfied without sorting the data.

With the JOINKEYS solution the data will be automaticallly sorted as part of the process, unless, as you say, SORTED is specified on the JOINKEYS, meaning the data is already sorted. As the data is unsorted, using the JOINKEYS,SORTED may not produce the required output, if anyone was thinking of trying that.

Even if the input is sorted, conveniently, on the key for matching, the JOINKEYS will still require more resources for it's main and two sub-tasks and just an OPTION COPY/SORT FIELDS=COPY.
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

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top