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
 

 

Count of particular characters in a record

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

New User


Joined: 24 Feb 2011
Posts: 15
Location: India

PostPosted: Fri Oct 28, 2011 5:36 pm    Post subject: Count of particular characters in a record
Reply with quote

Hi All,

I have a FB dataset lrecl = 80. sample i/o is as follows.

q,werty
poi,uyt
asdf,g,h

Is it possible to count the number of ',' in each record and display it?

If yes could you please let me know?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Oct 28, 2011 5:59 pm    Post subject:
Reply with quote

look for the inspect tallying format 3.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 28, 2011 6:16 pm    Post subject: Reply to: Count of particular characters in a record
Reply with quote

Yes. 1, 1, 2.

What language do you want to use? I'm not sure it can be done with DFSORT if that is what you wanted, but we'll get a confirmation later.

What do you want to know for? Knowing what you want may remove your need to actually count...
Back to top
View user's profile Send private message
Musab Razeen Ahmed

New User


Joined: 24 Feb 2011
Posts: 15
Location: India

PostPosted: Fri Oct 28, 2011 6:20 pm    Post subject: DFSORT the best
Reply with quote

I was looking or a DFSORT Code. (for the sake of simplicity)

I was looking over manuals, but couldn't figure out a logic to do this. That's why posted the same.
Back to top
View user's profile Send private message
Musab Razeen Ahmed

New User


Joined: 24 Feb 2011
Posts: 15
Location: India

PostPosted: Fri Oct 28, 2011 6:22 pm    Post subject: thanks to Dick Brenholtz
Reply with quote

Any ways the INSPECT TALLYING link provided by Dick Brenholtz was helpful for the time being.

But I would like to work on DFSORT to achieve the same.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Oct 28, 2011 6:43 pm    Post subject:
Reply with quote

Sorry,
my bad, did not notice that it was the dfsort forum.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 28, 2011 6:47 pm    Post subject: Reply to: Count of particular characters in a record
Reply with quote

The Cobol would be simple. rexx would be simple. I can't see anything springing out of DFSORT, but you'lll find out later.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Oct 28, 2011 7:16 pm    Post subject:
Reply with quote

Musab Razeen Ahmed,
Is there a limit to max. number of occurrences for comma ','?

What is your DFSort function level?

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 02, 2011 2:30 am    Post subject:
Reply with quote

Musab,

You can do what you want with a DFSORT job like the following. I assumed you have a maximum of 10 commas in one record and that you want to display the count in positions 81-85 of each record.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
q,werty
poi,uyt
asdf,g,h
a,b,,,,c,,d,,x,y
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
        PARSE=(%01=(STARTAT=C',',FIXLEN=1),
               %02=(STARTAT=C',',FIXLEN=1),
               %03=(STARTAT=C',',FIXLEN=1),
               %04=(STARTAT=C',',FIXLEN=1),
               %05=(STARTAT=C',',FIXLEN=1),
               %06=(STARTAT=C',',FIXLEN=1),
               %07=(STARTAT=C',',FIXLEN=1),
               %08=(STARTAT=C',',FIXLEN=1),
               %09=(STARTAT=C',',FIXLEN=1),
               %10=(STARTAT=C',',FIXLEN=1)),
        OVERLAY=(81:%01,%02,%03,%04,%05,%06,%07,%08,%09,%10)),
    IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,IN=C',',OUT=C'1')),
    IFTHEN=(WHEN=INIT,
      BUILD=(1,80,81,1,ZD,ADD,82,1,ZD,ADD,83,1,ZD,ADD,84,1,ZD,ADD,
             85,1,ZD,ADD,86,1,ZD,ADD,87,1,ZD,ADD,88,1,ZD,ADD,
             89,1,ZD,ADD,90,1,ZD,TO=ZD,LENGTH=5))
/*


SORTOUT would have:

Code:

q,werty                                                                         00001
poi,uyt                                                                         00001
asdf,g,h                                                                        00002
a,b,,,,c,,d,,x,y                                                                00010


If that's not what you want, then you need to do a better job of explaining what you do want.
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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