Hallo ExAzubi,
schön, dass alle dieselben Probleme haben...
Ich hatte damals nichts gefunden und es programmiert. Vielleicht hilft Dir das?
Das Bsp ersetzt in einem String die Zeichenkette SWNETIxxx durch den Parameter und füllt auf 10 Zeichen auf.
Ohne Gewähr, kann man bestimmt auch noch schöner machen.
Gruß
Christian
Code:
*
*----- Prototypen
D pReplace PR
D $opt 100 const options(*varsize)
D $val 100 const options(*varsize)
D $vallen 5 0 const
D $cmd 200
*
...
callp pReplace('SWNETIxxx' :p$outq :10:z)
...
P pReplace B
*========
*
D pReplace PI
D $opt 100 const options(*varsize)
D $val 100 const options(*varsize)
D $vallen 5 0 const
D $cmd 200
*
C ' ' checkr $opt optlen 5 0 50
C n50 goto pReplaceX
C if %subst($opt: 1 :optlen) =
C %subst($val: 1 :$vallen)
C goto pReplaceX
C endif
*
C $vallen subst(p) $val:1 val 100
*
*--- Parameter ggf. einsetzen
C move *zero n5 5 0
C eval n5 = %scan(%trimr($opt):$cmd)
C n5 dowgt *zero
*
C n5 ifeq *zero
C eval $cmd = %trim(val) +
C %subst($cmd: optlen)
C else
C eval $cmd = %subst($cmd: 1: n5-1) +
C %trim(val) +
C %subst($cmd: n5+optlen)
C endif
*
C eval n5 = %scan(%trimr($opt):$cmd)
C enddo
*
C pReplaceX tag
* =========
P pReplace E
*
Bookmarks