This is very similar to an old question/thread from a couple of years ago.
I posted what turned out to be the fastest solution, which resulted from using SEPARATE with the digits 0 through 9 as delimiters.
Depending on your answers to Jerome’s posting, the following code may suggest an appropriate solution:
DEFINE DATA LOCAL
1 #IN (A20) INIT <‘QWERT12ASDFG’>
1 #OUT (A20)
1 #TEMP (A/1:10) DYNAMIC
1 #NUM (I2)
SEPARATE #IN INTO #TEMP (*) WITH
RETAINED DELIMITERS ‘0123456789’
GIVING NUMBER #NUM
PRINT #TEMP (1) / #TEMP (2) / #TEMP (3) / #TEMP (4) /
#TEMP (5) / #TEMP (6)
WRITE LENGTH (#TEMP ()) / #NUM
PAGE # 1 DATE: 09-08-20
PROGRAM: REVERS01 LIBRARY: INSIDE
5 1 0 1 5 0
0 0 0 0
If #NUM is a 1, there are no digits in the string.
If #NUM is a 3, there is a single digit in the string (no reversal required)
If #NUM is a 5, there is either a 2 digit string (there will be a sequence 101 in the lengths of #TEMPs, or two one digit strings (no reversal required)).
You can play with this depending on exactly what you require.