search cancel

Replace tabulator characters from string

book

Article ID: 89375

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

Affects Release version(s): null

Replace tabulator characters from string

Environment

Release:
Component: AAUTEN

Resolution

At the moment it is not possible to replace tabulator strings with a script command.
Here you could use the following include replacing tabulator characters from the start and end of a string:

Include Object (JOBI.TAB_REPLACE):


:SET &VAL#=STR_REVERSE(&VAL#)
:SET &STRING#=HEX(&VAL#)
:SET &length#=STR_LENGTH(&STRING#)
:SET &length#=ADD(&length#, 1)
:WHILE &length# > 0
:  SET &length#=sub(&length#, 2)
:  SET &STRING2# = SUBSTR(&STRING#, &length#, 2)
:  SET &POS2#=STR_FIND_REV(&STRING2#, '09')
:  if &POS2#=0
:    SET &POS#=add(&length#, 2)
:    SET &length# = 0
:  endif
:ENDWHILE
:if &POS# > 0
:  SET &PAR#=MOD(&POS#, 2)
:  IF &PAR#=1
:    SET &POS#=sub(&POS#, 1)
:    SET &POS#= div(&POS#, 2)
:    SET &VAL# = SUBSTR(&VAL#, 1, &POS#)
:  ENDIF
:ENDIF

:SET &VAL#=STR_REVERSE(&VAL#)
:SET &STRING#=HEX(&VAL#)
:SET &length#=STR_LENGTH(&STRING#)
:SET &length#=ADD(&length#, 1)
:WHILE &length# > 0
:  SET &length#=sub(&length#, 2)
:  SET &STRING2# = SUBSTR(&STRING#, &length#, 2)
:  SET &POS2#=STR_FIND_REV(&STRING2#, '09')
:  if &POS2#=0
:    SET &POS#=add(&length#, 2)
:    SET &length# = 0
:  endif
:ENDWHILE
:if &POS# > 0
:  SET &PAR#=MOD(&POS#, 2)
:  IF &PAR#=1
:    SET &POS#=sub(&POS#, 1)
:    SET &POS#= div(&POS#, 2)
:    SET &VAL# = SUBSTR(&VAL#, 1, &POS#)
:  ENDIF
:ENDIF

To use this include use the following syntax:

:  SET &VAL#=&STRING_WITH_TAB#
:  INCLUDE JOBI.TAB_REPLACE
:  SET &STRING_WITH_TAB #=&VAL#

This include script needs the input variable &VAL#.

After removing all tabulator characters the include object returns the new string.
In this case the sample deliver string is called &STRING_WITH_TAB#.