I have requirement like below input file , At end i need to write GAIN and NON-GAIN combination of same accnt_num
i/P:
accnt_num cust_num status
0192002682|0000001004931|GAIN
0192002682|0000000706570|NON-GAIN
4000000018|0001935277780|GAIN
4000000018|0001943580989|GAIN
5192002681|0000001004932|GAIN
5192002681|0000000706570|NON-GAIN
6792002686|0000000706570|NON-GAIN
6992002688|0000000706570|GAIN
7192002683|0000001004932|NON-GAIN
7192002683|0000000706570|GAIN
Desired output :
O/P:
0192002682|0000001004931|GAIN
0192002682|0000000706570|NON-GAIN
5192002681|0000001004932|GAIN
5192002681|0000000706570|NON-GAIN
7192002683|0000001004932|NON-GAIN
7192002683|0000000706570|GAIN
Can soemone please help me on this.
Comparing records within same file
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Sure William,William Collins wrote:OK, can you show some variations of the more than two in your sample data, with expected output?
I/P:
accnt_num cust_num status
0192002682|0000001004931|GAIN
0192002682|0000000706570|NON-GAIN
0192002682|0000001004931|GAIN
0192002800|0000001004931|GAIN
4000000018|0001935277780|GAIN
4000000018|0001943580989|GAIN
5192002681|0001004932|GAIN
5192002681|0000000706570|NON-GAIN
6792002686|0000000706570|NON-GAIN
6992002688|0000000706570|GAIN
7192002683|0000001004932|NON-GAIN
7192002683|0000000706570|GAIN
7192002683|0000001004932|NON-GAIN
Desired output :
O/P:
0192002682|0000001004931|GAIN
0192002682|0000000706570|NON-GAIN
0192002682|0000001004931|GAIN
5192002681|0000001004932|GAIN
5192002681|0000000706570|NON-GAIN
7192002683|0000001004932|NON-GAIN
7192002683|0000000706570|GAIN
7192002683|0000001004932|NON-GAIN
efge
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
A JOINKEYS, with the same dataset for both inputs.
Use a JNF2CNTL DD.
Extend each record, with INREC to have two counts. Set the count to 1 for GAIN (with non-gain-count count being zero) and vice versa.
SUM those two fields.
The JOINKEYS will match on the key, and if both counts are non-zero you have an account you want.
Use a JNF2CNTL DD.
Extend each record, with INREC to have two counts. Set the count to 1 for GAIN (with non-gain-count count being zero) and vice versa.
SUM those two fields.
The JOINKEYS will match on the key, and if both counts are non-zero you have an account you want.
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page