I have a requirement to find the last occurrence of a character in a string in CL. For Example, If I have a string as Test_01_abc.Txt , and I have to get the last occurrence of '_'(Underscore), I need to get answer as 8(Which is the position of the second Underscore in the string).
I am using 7.2 Version and %SCANR is not working here. One way is to go in a loop and search it. Is there a better way?
THanks
Last Occurrence of a character in a String in a CL
740 Views Asked by AS400 User At
1
There are 1 best solutions below
Related Questions in IBM-MIDRANGE
- How can i use Java to call an existing RPG screen program?
- SQL access to RPG OPM database files
- PHP rollback on IBMi db2 doesn't work
- DB2 Concatenate rows
- How to configure IBM i Netserver share so that a new IFS file has its ccsid attribute set to a specified ccsid different from Netserver ccsid
- pyodbc rowcount return in negative
- Using a custom comparator for std::map on IBM i-Series
- IBM i (as400) CIM and ethernet interfaces
- Hikari connections and active AS400 jobs
- Syntax error in odbc.ini
- Create a IBM i Java Toolkit RecordFormat from an IBM i File
- CL: Path name contains embedded nulls (CPD018A)
- AS/400 End User - run keystrokes automatically
- Get Column Description from iSeries v7r1 export to Excel or Access
- Deploy IBM Client Access V7r1 Silently
Related Questions in CONTROL-LANGUAGE
- CL: Path name contains embedded nulls (CPD018A)
- Decimal To Character Conversion On AS/400
- AS/400 IFS authorities issue
- How to run a command that submit a JOB to QBATCH then get JOB number for later use in CL PGM
- Type of a passed parameter in a CL CALL statement
- IBM i RPG programs are referencing the wrong library after calling them using a JT400 connection pool
- Running a batch File in AS400
- ISERIES OS/400 error checking
- How do CL commands build their exact parameter lists?
- In CL programming, How to read last record of physical file member
- CLLE SNDRCVF command not allowed
- Trimming variable in CLLE
- How do you email to a userlist in CL?
- Mail database file as excel from AS400
- send mail with SNDDST
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
%SCANRis an RPGLE built in function, not CLP. However, given that you are at v7.2, your only choce is to putQCLSCANin a loop and find the last occurrance that way. There might be a way to do what you want inPythonif you are willing to use that rather than CL.