IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sort to find out the char which repeated in a string


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
angel246

New User


Joined: 05 Jul 2024
Posts: 4
Location: india

PostPosted: Wed Jul 10, 2024 2:06 pm
Reply with quote

Hi ,
I need the sort card to find out the characters which are repeated in a particular field. the i/p file is as mentioned below

Denise Terry 101 Healthcare
Harrison Robbert 102 ECE
Harrison Jaccob 103 Manufacturing

I/P file Layout as follow: 1-25[ Person Name] 26-3 [emp#] 30-10[Dept]

Need to extract the chars which are repeated in Person Name field i.e 1-25 position and display those characters in output file

The output should be:

R ------> for 1st rec
R,B ------> for 2nd Rec
R,C ------> for 3rd rec

thanks in advance
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1295
Location: Bamberg, Germany

PostPosted: Wed Jul 10, 2024 2:20 pm
Reply with quote

Your attempts to achieve that are?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1295
Location: Bamberg, Germany

PostPosted: Wed Jul 10, 2024 3:09 pm
Reply with quote

Basically you can get results as
Code:
Denise Terry                                             r 
Harrison Robbert                                   r       b
Harrison Jaccob                                    r       c
Sauerstoffflasche                                        ff

The problem is with the last entry where you have three repeating chars.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Wed Jul 10, 2024 5:13 pm
Reply with quote

SORT is not convenient for a task of this kind. It resembles using a screwdriver for hammering nails: this is also possible, but highly inconvenient.

Are you familiar with any other mainframe tool? There are plenty of much more suitable ones.
Back to top
View user's profile Send private message
angel246

New User


Joined: 05 Jul 2024
Posts: 4
Location: india

PostPosted: Wed Jul 10, 2024 5:26 pm
Reply with quote

yeah i can understand sort is not convenient way but It was asked in one of interviews i said it can be achieved in cobol using Inspect but he asked me to do in SORT . So i am curious to know.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Wed Jul 10, 2024 6:15 pm
Reply with quote

Something like this is possible, though senseless...
Code:
Denise Terry                  r                         
Harrison Robbert              r,b                       
Harrison Jaccob               r,c                       
Sauerstoffflasche             ff                       
Aabbccddeeffgghhh             b,c,d,e,f,g,hh           
Drossellklappann              s,l,p,n                   

Serious drawback: 'A' != 'a'
Back to top
View user's profile Send private message
angel246

New User


Joined: 05 Jul 2024
Posts: 4
Location: india

PostPosted: Thu Jul 11, 2024 12:04 am
Reply with quote

sort card plz to achieve this?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Thu Jul 11, 2024 12:09 am
Reply with quote

angel246 wrote:
sort card plz to achieve this?

First of all, please show us any of your own efforts.

The style of this forum is supposed to be as follows:
Quote:
I need to do the task like <this>

I tried to achieve it using <this> method, and used <this> code to perform it.

I expected to get the results like <this> and <this>, but instead I received <this> result, and <this> messages.

Please advise, what did I wrong, or how to find the reason of misbehavior?

Thank you


Instead of said above your style of discussion is as follows:
Quote:
I have a requirement to do <this> and <this>.

I'm new to mainframe (or to Computer Science), so I have not a minor idea: how it can be done?

Please, do my full job for me, if you can.

Thank you
Back to top
View user's profile Send private message
angel246

New User


Joined: 05 Jul 2024
Posts: 4
Location: india

PostPosted: Sun Jul 14, 2024 3:52 pm
Reply with quote

Currently i dont have mainframe id as i lost my job i started attending interviews ..this is one of interview questions which i faced in one of interviews..I tried to figure out by thinking of all the options in sort based on my knowledge..but i couldnt get it..if i get any online sort compiler i can try like cobol online compiler for cobol program.

I checked in google to get the sort card which can do the count of the repeated occurrence of characters in a field i couldnt get it
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2081
Location: USA

PostPosted: Sun Jul 14, 2024 5:34 pm
Reply with quote

Access to mainframe would not help unless one has got any minor idea in his mind. Access to documentation is required.

In the interview usually nobody is given access to a computer, too.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3066
Location: NYC,USA

PostPosted: Mon Jul 15, 2024 2:58 pm
Reply with quote

Cleaned up the post ..
if it was asked in an interview then am moving to another meter view section of this forum and also please use code tags while representing any data or code.

Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts Looking for help with SORT JCL/SYNC sort DFSORT/ICETOOL 6
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
No new posts Dynamically build sort control statem... SYNCSORT 18
No new posts Sort & Sum on Key SYNCSORT 7
Search our Forums:

Back to Top