how to get the count of records providing certain condidtion
Moderators: Frank Yaeger, DikDude, Moderator Group
how to get the count of records providing certain condidtion
Hi All,
I have PS (FB, 113 LRECL) file which contains 2 fields:
Field1 - starts at 1 & 6 bytes in length
Field2 - Starts at 8 & 9 bytes in length
Here is sample data in the file-
ASS002 009878654
ASS002 998634664
ASS002 485781533
ARR003 346583746
ARR003 361764465
AZZ987 346764766
My Requirement is, I want output PS in following format -
ASS002 3
ARR003 2
AZZ987 1
Can some one help me out??
I have PS (FB, 113 LRECL) file which contains 2 fields:
Field1 - starts at 1 & 6 bytes in length
Field2 - Starts at 8 & 9 bytes in length
Here is sample data in the file-
ASS002 009878654
ASS002 998634664
ASS002 485781533
ARR003 346583746
ARR003 361764465
AZZ987 346764766
My Requirement is, I want output PS in following format -
ASS002 3
ARR003 2
AZZ987 1
Can some one help me out??
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Your file is not in sequence, and it seems you want it to stay that way.
So, how about looking at the "reporting functions" available on OUTFIL with your sort product? See what SECTIONS might be able to do for you.
Remember, if you have keys which are not contiguous, you will need to sort if they are to be included all together. Then you'd have to get back to original order, according to your sample output.
Why do you describe the second field? It is only the first that you seem to be using.
So, how about looking at the "reporting functions" available on OUTFIL with your sort product? See what SECTIONS might be able to do for you.
Remember, if you have keys which are not contiguous, you will need to sort if they are to be included all together. Then you'd have to get back to original order, according to your sample output.
Why do you describe the second field? It is only the first that you seem to be using.
Hi Hima -
This can be done thru SORT
Result in the Spool -
This can be done thru SORT
Code: Select all
//R020 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ASS002 009878654
ASS002 998634664
ASS002 485781533
ARR003 346583746
AZZ987 346764766
ARR003 361764465
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(01,6,CH,A)
INREC OVERLAY=(17:C'0000001')
SUM FIELDS=(17,7,ZD)
OUTREC FIELDS=(01,6,X,17,7)
Code: Select all
********************************* TOP OF DATA *****
ARR003 0000002
ASS002 0000003
AZZ987 0000001
******************************** BOTTOM OF DATA ***
Guru:-)
You're never fully dressed without a smile
You're never fully dressed without a smile
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
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