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
 

 

How to Compare Two Records in the Same File

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

New User


Joined: 04 Oct 2005
Posts: 31

PostPosted: Wed Jul 04, 2012 11:16 am    Post subject: How to Compare Two Records in the Same File
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: 1445
Location: Azeroth

PostPosted: Wed Jul 04, 2012 12:27 pm    Post subject:
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: 1712
Location: UK

PostPosted: Wed Jul 04, 2012 12:31 pm    Post subject:
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: 31

PostPosted: Wed Jul 04, 2012 1:28 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jul 04, 2012 1:35 pm    Post subject:
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: 31

PostPosted: Wed Jul 04, 2012 2:03 pm    Post subject:
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: 1712
Location: UK

PostPosted: Wed Jul 04, 2012 6:45 pm    Post subject:
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

Moderator


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

PostPosted: Wed Jul 04, 2012 7:11 pm    Post subject:
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: 31

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

We are using DFSORT
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jul 04, 2012 7:37 pm    Post subject:
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    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 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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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


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