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

Compare 2 rocords within a same file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Mar 03, 2010 1:06 pm
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
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
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: 2481
Location: @my desk

PostPosted: Wed Mar 03, 2010 4:40 pm
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: 8797
Location: Welsh Wales

PostPosted: Wed Mar 03, 2010 5:01 pm
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
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
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: 2481
Location: @my desk

PostPosted: Wed Mar 03, 2010 5:47 pm
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

Moderator Emeritus


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

PostPosted: Wed Mar 03, 2010 8:32 pm
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
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

Moderator Emeritus


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

PostPosted: Thu Mar 04, 2010 8:28 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top