Page 1 of 1

How To display the count based on a specific string?

PostPosted: Fri Aug 19, 2022 12:59 am
by Chintu333
Hello All,

I have a requirement of getting the count of records from an input file based on a particular field value.
For example.

If in column 10 of input file there exists values as A, B, and C, I need to take the count as below:

Count of records that has value A in column 10
Count of records that has value B in column 10
Count of records that has value C in column 10

I want to display these counts separately in the same file.

Sample output file should look like.

Count of A rec. Count of B rec Count of C
500. 600. 200.


Can we do this using the Dfsort Trailer1=Count operator?Please advise.

Thanks

Re: How To display the count based on a specific string?

PostPosted: Fri Aug 19, 2022 1:41 am
by Chintu333
EDIT POST:

Hello All,

I have a requirement of getting the count of records from an input file based on a particular field value.
For example.

If in column 10 of input file there exists values as A, B, and C, and in column 15 there's indicator as Y or N, I need to take the count as below:

Count of records that has value A in column 10 with indicator Y
Count of records that has value B in column 10 with indicator N
Count of records that has value C in column 10 indicator N

I want to display these counts separately in the same file.

Sample output file should look like.

Count of A rec with Indicator Y
600
Count of B rec with indicator N
500
Count of C rec with Indicator N
200


Can we do this using the Dfsort Trailer1=Count operator?Please advise.

SORRY, I COULD NOT FIND ANY EDIT POST BUTTON. SO REPOSTING AS A REPLY

Thanks

Re: How To display the count based on a specific string?

PostPosted: Fri Aug 19, 2022 3:00 am
by sergeyken
RTFM about OUTFIL SECTIONS=

Re: How To display the count based on a specific string?

PostPosted: Fri Aug 19, 2022 8:52 pm
by sergeyken
Chintu333 wrote:SORRY, I COULD NOT FIND ANY EDIT POST BUTTON. SO REPOSTING AS A REPLY

The EDIT button can be found at the right top corner of your previous post, but only during 30 minutes after its posting.

After 30 minutes the ability to edit your post is blocked.