Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract data from Master file in Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Extract data from Master file in Syncsort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Apr 28, 2012 12:20 am    Post subject: Reply to: Help in Syncsort
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Apr 30, 2012 2:34 pm    Post subject: Reply to: Extract data from Master file in Syncsort
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

Senior Member


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

PostPosted: Mon Apr 30, 2012 6:06 pm    Post subject: Re: Reply to: Extract data from Master file in Syncsort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Apr 30, 2012 7:21 pm    Post subject: Reply to: Extract data from Master file in Syncsort
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us