1.find most occurrences of a character.
for exm: input:aaabbbbdddddyyy
output: d 5 times
how can i get that?
Answer Posted / bharatiya
I was trying it last night and wrote the below code that works for this scenario, please have a look----
DArr1 S 1 DIM(10)
DArr2 S 1 DIM(10)
DCnt S 2 0
Dn1 S 2 0 Inz(1)
Dn2 S 2 0 Inz(1)
DFld1 S 15 Inz('aaabbbbdddddyyy')
C
C Do 15
C EVAL Arr1(n1) = %subst(FLD1:n1:1)
C If Arr1(n1) = 'd'
C Eval Arr2(n2) = Arr1(n1)
C Eval n2 = n2 +1
C Endif
C Eval n1 = n1+1
C Enddo
C Eval cnt = n2 - 1
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.
can I touch the array during treatments?
Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?
what is the rpg system?
how can you display specific subfile page on the screen in unequal subfile?
What is file identifier where we can use?
What is the difference between iter and do?
if there is a module object , how to find the program object for this module object.Assume the module object name and program object name is not same.
how do you use commitment control in rpg?
How to call one program from another program in RPG? please help me with the code
1. If there are two programs using same file and 2 users are using the file at the same time and what can be done to allow them both to access? 2. How can remove lock from the file for accessing it by both users?
what is the procedure and explain about real time scenario.
Set on command is used for closed all opened files , initialize var and release resource , return cmd is used for return to calling program but my req. Is dnt close opened files and resource must released while doing transactions , how can i do this...?
We have job which is running as batch. It takes atleast 06 hours to complete tht job. But I wanna do tht job with in 3 hours?
How to declare the pull button in AS/400..