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
What is a record lock error?
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.
what is the use of sflnxtchg?
how does the rpg element work?
what is the rpg system?
Suppose we have one database file and it is used by 5 programs and in 3 program we have to add some records in datbase file s what is the impact on other program?
When we have a file with Duplicate records and I want to read the unique record from the file. For example a file containing Emp Name as 'Ram' and there are 3 entries of it. So how to read a unique record from File?
what is file information data structure?
How to call one program from another program in RPG? please help me with the code
how do I play {insert rpg system here}?
write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen
Hi Viewers can any body explain me how to update and ahange the already existed data in physical file using subfile ? please explain me with the code if possible?
do you use message subfiles? What are the necessary keywords required coding a message subfile?
Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.
how can you display specific subfile page on the screen in unequal subfile?