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 records within a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Mahua Mitra

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Thu Apr 10, 2008 3:49 pm    Post subject: Compare records within a file
Reply with quote

Hi

I have a file. The file has to compare three columns(C1, C2, C3) of the records. If the value of C1 and C2 are same, then have to compare C3 (date field). The row/rows having maximum value of C3 (value of C3 should be less/equal to than current date), such rows have to be written in the output file.

Sample input file
Code:
C1             C2       C3 (dd/mm/yyyy)           C4            C5
100            10       10/04/2007                 a             b
100            10       10/04/2007                 c             d
100            10       09/04/2007                 e             f
100            20       09/04/2007                 g             h
100            20       08/04/2007                 i             j
100            20       07/04/2007                 k             l
100            30       09/04/2007                 m             n
100            30       09/04/2007                 o             p
200            10       10/04/2007                 q             r
200            10       10/04/2007                 s             t
200            10       08/04/2007                 u             v
200            20       10/04/2007                 w             x
300            40       10/04/2007                 y             z
300            50       10/04/2007                 0             1
300            60       10/04/2007                 2             3
300            60       09/04/2007                 4             5
300            60       08/04/2007                 6             7


Required output

Sample input file
Code:
C1             C2       C3 (dd/mm/yyyy)           C4            C5
100            10       10/04/2007                 a             b
100            10       10/04/2007                 c             d
100            20       09/04/2007                 g             h
100            30       09/04/2007                 m             n
100            30       09/04/2007                 o             p
200            10       10/04/2007                 q             r
200            10       10/04/2007                 s             t
200            20       10/04/2007                 w             x
300            40       10/04/2007                 y             z
300            50       10/04/2007                 0             1
300            60       10/04/2007                 2             3



Can anyplease please let me know, will this be possible thorugh a SORT step. If yes, what will specified in the SORT card.

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

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 10, 2008 10:15 pm    Post subject:
Reply with quote

I can't make any sense out of what you show for the example vs what you say you want.

Quote:
the value of C1 and C2 are same


But none of the records in your example have the same value for C1 and C2.

Quote:
then have to compare C3 (date field).


Compare C3 to what?

Quote:
The row/rows having maximum value of C3


Maximum of C3? Relative to what?

Quote:
value of C3 should be less/equal to than current date)


I don't understand how this fits in.

You need to do a much better job of explaining the "rules" for what you want to do and how they relate to your example before anyone can help you.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Fri Apr 11, 2008 10:13 am    Post subject: Reply to: Compare records within a file
Reply with quote

Frank,

He is comparing C1 & C2 of First Row with C1 and C2 of 2nd Row.

If the above condition is true then comare dates of First Row and 2nd Row i.e C3.. Write out the highest date rows in the ouput file.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Apr 11, 2008 10:13 pm    Post subject:
Reply with quote

Shrivatsa,

Thanks. Now that you mention it, I think you're right that he's comparing C1 and C2 between records rather than in each record.

Mahua,

I still don't understand how this statement fits in to all of this:

Quote:
value of C3 should be less/equal to than current date


Please explain.

Also, what is the RECFM and LRECL of the input file, and the starting position, length and format of C1, C2 and C3?
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 -> DFSORT/ICETOOL 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 10 Tue May 16, 2017 2:20 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3: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