Compare two records in the same ps file.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Locked
Sureshpathi10
Member
Posts: 6
Joined: Thu Oct 15, 2009 11:12 am
Location: Kuala Lumpur

Compare two records in the same ps file.

Post by Sureshpathi10 » Thu Dec 19, 2013 8:00 am

I've a requirement to create two output files from one single file.

Code: Select all

ID             CODE
11111          AAAA
11111          BBBB
11111          CCCC
11111          EEEE
22222          AAAA
22222          CCCC
22222          DDDD
22222          EEEE
22222          FFFF
From the above file,
File 1 should contain:
1. Same ID with code 'AAAA' AND 'BBBB'
2. Same ID with code 'CCCC' AND 'DDDD'
2. Same ID with code 'EEEE' AND 'FFFF'

File 2 should contain all other non-matched records

output should be
File 1

Code: Select all

ID             CODE
11111          AAAA
11111          BBBB
22222          CCCC
22222          DDDD
22222          EEEE
22222          FFFF
File 2

Code: Select all

ID             CODE
11111          CCCC
11111          EEEE
22222          AAAA
Any help would be greatly appreciated.

devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

Post by devegouda.chage » Thu Dec 19, 2013 12:29 pm

Hi Sureshpathi10,

Since its confusing with the same ID's..
little explaination needed...
like some condition/logic for considering for file1/ file2 :idea:
Thanks & Regards
Dev

Sureshpathi10
Member
Posts: 6
Joined: Thu Oct 15, 2009 11:12 am
Location: Kuala Lumpur

Post by Sureshpathi10 » Thu Dec 19, 2013 12:50 pm

Hi Devegouda,

There are only 6 CODEs that forms 3 groups.

AAAA & BBBB - Group 1
CCCC & DDDD - Group 2
EEEE & FFFF - Group 3

If SAME id has any one of the Group mentioned above, it should written to File 1.
All other records should be in File 2.

I Hope this will help you to understand. Thanks for your efforts.
Thanks,
Suresh Ramaiyan

devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

Post by devegouda.chage » Thu Dec 19, 2013 2:21 pm

Hi Suresh,
I may not able to solve your problem :( ,as it is tricky in choosing the similar record from the ID column,but i found some what similar requirement in the below thread,it may help you :idea:


http://www.mainframegurukul.com/ibmmain ... t4890.html
Thanks & Regards
Dev

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Thu Dec 19, 2013 9:25 pm

Suresh

You have been members of a forum long enough to know that you do not multiple post the same question at the same time. I suggest a moderator lock all topics bar one.
Regards
Nic

Locked

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others