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
 

 

Compare 2 rocords within a same file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Wed Mar 03, 2010 12:17 pm    Post subject: Compare 2 rocords within a same file
Reply with quote

Hi,

I have a requirement where I need to compare two records from a same file and if a match is found write it in an output file.I am new to working with sorts in JCL.Please let me know how can this be done.

eg : REC1
REC2
REC2
REC3

The output file should contain REC2.

TIA
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Mar 03, 2010 12:39 pm    Post subject:
Reply with quote

What is the sort product installed at your shop(DFSORT\SYNCSORT\CA-SORT.... ) ?

Also you need to define your problem precisely.
Show the output for below sample
Code:

REC1
REC2
REC2
REC3
REC3
REC3
Back to top
View user's profile Send private message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Wed Mar 03, 2010 12:58 pm    Post subject:
Reply with quote

Sambhaji wrote:
What is the sort product installed at your shop(DFSORT\SYNCSORT\CA-SORT.... ) ?

Also you need to define your problem precisely.
Show the output for below sample
Code:

REC1
REC2
REC2
REC3
REC3
REC3


Either of DFSORT or SYNCSORT can be used.

For the above input,the output should be

Code:

REC2
REC2
REC3
REC3
REC3
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Mar 03, 2010 1:06 pm    Post subject:
Reply with quote

Hang on a mo .............. we are getting nowhere fast with the information that you have bothered to tell us. What are the rules from getting from input to output, the RECFM and LRECL of the input, the position, length and format of the key fields.

As for either sort product, there are so very few sites with both installed, so .....

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT and your topic will be moved to the appropriate forum. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Mar 03, 2010 1:09 pm    Post subject:
Reply with quote

Below DFSORT ICETOOL step will give you desired result.
Code:

//STEP050  EXEC PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                     
//DFSMSG    DD SYSOUT=*                     
//IN   DD *                                 
REC1                                       
REC2                                       
REC2                                       
REC3                                       
REC3                                       
REC3                                       
//OUT  DD  SYSOUT=*                         
//TOOLIN   DD *                             
  SELECT FROM(IN) TO(OUT) ON(1,4,CH) ALLDUPS
/*                                         
Back to top
View user's profile Send private message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Wed Mar 03, 2010 3:13 pm    Post subject: Reply to: Compare 2 rocords within a same file
Reply with quote

The syncsort version used is 1.3.2.1R.But we can use both DFSORT and SYNCSORT for our product.

The format for Input and Output is the same.

I think the above reply posted by Sambhaji should work fine.I need to check few more options like XSUM before I can proceed with the above mentioned sort.

Thanks for replies.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Wed Mar 03, 2010 4:40 pm    Post subject:
Reply with quote

Quote:
The syncsort version used is 1.3.2.1R.But we can use both DFSORT and SYNCSORT for our product
Did you mean that you have both the products installed there?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Mar 03, 2010 5:01 pm    Post subject:
Reply with quote

Please post the requested output from your sort product.
Back to top
View user's profile Send private message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Wed Mar 03, 2010 5:18 pm    Post subject:
Reply with quote

Arun Raj wrote:
Quote:
The syncsort version used is 1.3.2.1R.But we can use both DFSORT and SYNCSORT for our product
Did you mean that you have both the products installed there?



yes both the products are installed.DFSORT V1R5 is also installed along with SYNCSORT
Back to top
View user's profile Send private message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Wed Mar 03, 2010 5:37 pm    Post subject:
Reply with quote

expat wrote:
Please post the requested output from your sort product.


When i run the sort,it displays messages(start with WER) for SYNCSORT.......but I can confirm that we have both the products installed.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Wed Mar 03, 2010 5:47 pm    Post subject:
Reply with quote

Code:
but I can confirm that we have both the products installed
Are you able to run a DFSORT job and generate ICE messages?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 03, 2010 8:32 pm    Post subject:
Reply with quote

Hello,

Quote:
I need to check few more options like XSUM before I can proceed with the above mentioned sort.
Why? I suspect the solution Sambhaji posted does what you need. . .
Back to top
View user's profile Send private message
sachinkl

New User


Joined: 30 Jan 2010
Posts: 6
Location: pune

PostPosted: Thu Mar 04, 2010 11:42 am    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

Quote:
I need to check few more options like XSUM before I can proceed with the above mentioned sort.
Why? I suspect the solution Sambhaji posted does what you need. . .


yes.....it works as required......thanks Sambhaji
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 04, 2010 8:28 pm    Post subject: Reply to: Compare 2 rocords within a same file
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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