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

How to Compare Two Records in the Same File


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 34

PostPosted: Wed Jul 04, 2012 11:16 am
Reply with quote

I have one file with the following information

Client No (21 bytes character)
Card Number (19) Bytes character)
Debitcard No(21 bytes character)
Date(8 Bytes character)
Status code(10 Bytes character)
Last issue Indicator ( 2 bytes Char)

File looks like this

Code:
730295318            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120118 06       0
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120123 06        1
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120123 06        0
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120123 08        0
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120123 08       1
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   00000000 10        0
730305844            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120508 08       0
730605763            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20111212 08       1
730606274            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120508 10        0


Output like this
--------------

Code:
730295318            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120118 06       0
730304839            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120123 06        0
730305844            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120508 08        0
730605763            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20111212 08        1
730606274            45XXXXXXXXXXXXX     45XXXXXXXXXXXXX   20120508 10        0

My requirement is given below
------------------------------------
1. If the cardno with the most recent date. If for the most recently issued card, the status is 06 or 08 AND Last issue Indicator those records are writes into output file.
Else
writes the records into output file.
compare the second record with 3rd,4th,5th and 5th records by using date filed.


2. if the dates are equal then check the satus code "06" or "08" and Last issue Indicator is '0' those records will be write into output file.

3.if the dates are equal then check the satus code not equal to "06" or "08" and Last issue Indicator is not '0' those records writes into output file.

4.if the dates are not equal records writes into output file.

All above mention requirement need to fullfill by using Sort only.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed Jul 04, 2012 12:27 pm
Reply with quote

Hello,
Is this not sensitive information that you are posting?
Just a word of warning. It is possible to withdraw cash from a debit card just with the number and expiry date and CVV.
One may have securid token authentication or SMS authentication or what not. But they can be very easily bypassed. Those features are flawed and intended to give false sense of security to users.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 04, 2012 12:31 pm
Reply with quote

Your equirements do not make sense. The number 1 - if a conditon is met write the record to output else write record to output. It seems in all the other requirments the same thing happens. So, explain again and what have you tried and what happened that was not correct?
Back to top
View user's profile Send private message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 34

PostPosted: Wed Jul 04, 2012 1:28 pm
Reply with quote

I need sort card for the following

Input file
-----------------
730295318 4519037302953185 4519932000031765 20120118 06 0
730304839 4519037303048399 4519932000051631 20120123 06 1
730304839 4519037303048399 4519932000019315 20120123 06 0
730304839 4519037303048399 4519932000019315 20120123 08 0
730304839 4519037303048399 4519932000022150 20120123 08 1
730304839 4519037303048399 4519932000022150 00000000 10 0
730305844 4519037303058448 4519932000068155 20120508 08 0
730605763 4519037306057637 4519932000008425 20111212 08 1
730606274 4519037306062744 4519932000066902 20120508 10 0


Output file1:
----------------
730295318 4519037302953185 4519932000031765 20120118 06 0
730305844 4519037303058448 4519932000068155 20120508 08 0
730605763 4519037306057637 4519932000008425 20111212 08 1

outputfile2:
-------------
730304839 4519037303048399 4519932000051631 20120123 06 0

outputfle 3:
------------
730606274 4519037306062744 4519932000066902 20120508 10 0


In above example each record have date field at poistion 68. Based on the date field compare each record in file. Here Input file length is 900.

1. If both dates are not equal then records should be writes into a output file1.

2. if both dates are equal then
check the Status field ='06' or '08' and Last issue indicator =0.
those records should be writes into a output file2.
3. if both dates are equal then
check the Status field notequal to '06' or '08' and Last issue indicator is not equal to 0.
those records should be writes into a output file3.
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: Wed Jul 04, 2012 1:35 pm
Reply with quote

If you use GROUP and PUSH the date and anything else you need from the first record for a client/card then you should be able to get your results.
Back to top
View user's profile Send private message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 34

PostPosted: Wed Jul 04, 2012 2:03 pm
Reply with quote

Could you please explain about the Group and Push with example.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 04, 2012 6:45 pm
Reply with quote

The manual has explanations and examples and I am sure the sort tricks document has more examples.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Jul 04, 2012 7:11 pm
Reply with quote

A quick question what is your sort product?
Back to top
View user's profile Send private message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 34

PostPosted: Wed Jul 04, 2012 7:17 pm
Reply with quote

We are using DFSORT
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: Wed Jul 04, 2012 7:37 pm
Reply with quote

OK. Decide on the start/length of your key.

Look in the manual for WHEN=GROUP with KEYBEGIN. For the first record of the group, PUSH the data that is required for the subsequent records - PUSH to the end of the record if fixed-length, the beginning of the record if variable-length.

Once you have done the PUSH the data you specifcy from the first record is available for all records in the group. So you can do your date test, for instance.

If you don't understand this already, consult the manual (link at the top of the forum, also the top of the page). Look at some examples in the forum (search for GROUP and PUSH). Ask if you still have problems, with a clear description of what the problem is.

If you work out the solution yourself, please post it here as it will help others with similar requirements in the future.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
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