Automic Workload Automation

 View Only

 Problems Setting Automic Variables with REGISTER_VARIABLE

Jump to  Best Answer
MartaLorenzon606904's profile image
MartaLorenzon606904 posted Nov 15, 2024 04:43 AM

Hi everyone,

I’m trying to store the output of a Bash command in variables within Automic 21.0.9.

As suggested in other community posts, I’ve configured my job as shown below. However, the Automic variables are not being set correctly.

Ref. other community posts -> Using REGISTER_VARIABLE | Automic Workload Automation

Could you please assist me? Alternatively, could you provide another solution for storing the Bash command output in Automic variables?

MY UNIX JOBS  (Bourne-Again-Shell; login shell, i.e. with profile loaded (-bash) )

IN THE PROCESS:

!
!### VARIABLE Automic 21.0.12
:PSET &OPENAR_FILENAME# = ""
:PSET &CLOSEDAR_FILENAME# = ""
!
!### VARIABLE AIX
nome_file_OpenAR="IT16_OpenAR.csv"
nome_file_ClosedAR="IT16_ClosedAR.csv"
echo "Aix variable OpenAR  :" $nome_file_OpenAR
echo "Aix variable ClosedAR:" $nome_file_ClosedAR
!
:REGISTER_VARIABLE &OPENAR_FILENAME#,$nome_file_OpenAR
:REGISTER_VARIABLE &CLOSEDAR_FILENAME#,$nome_file_ClosedAR
:PRINT "Print Variable OA in Process OPENAR_FILENAME   -> &OPENAR_FILENAME#"
:PRINT "Print Variable OA in Process CLOSEDAR_FILENAME -> &CLOSEDAR_FILENAME#"

IN THE POST PROCESS :

:PRINT "We are in a Post Process"
:PRINT "Print Variable OA in Post-Process OPENAR_FILENAME   -> &OPENAR_FILENAME#"
:PRINT "Print Variable OA in Post-Process CLOSEDAR_FILENAME -> &CLOSEDAR_FILENAME#"

THE RESULT IS

ACTIVATION :

2024-11-15 10:24:54 - U00005014 AgentGroup 'LAI_STAG_PN', client '30', version '2' has been resolved.
2024-11-15 10:24:54 - U00020237 The object variable '&OPENAR_FILENAME#' in object: 'WINGSL_CHECK_FILE_AR_MARTA', line: '00003' (RunID: '0012088688') has been created with the value '' by  using the command :PSET.
2024-11-15 10:24:54 - U00020206 Variable '&OPENAR_FILENAME#' was stored with value ''.
2024-11-15 10:24:54 - U00020237 The object variable '&CLOSEDAR_FILENAME#' in object: 'WINGSL_CHECK_FILE_AR_MARTA', line: '00004' (RunID: '0012088688') has been created with the value '' by  using the command :PSET.
2024-11-15 10:24:54 - U00020206 Variable '&CLOSEDAR_FILENAME#' was stored with value ''.
2024-11-15 10:24:54 - U00020408 Print Variable OA in Process OPENAR_FILENAME   ->
2024-11-15 10:24:54 - U00020408 Print Variable OA in Process CLOSEDAR_FILENAME ->

REPORT :

***************************************************************************
**  ucxja64m     version 21.0.9+build.1702489267437 changelist 1702489267  **
**  JOB 0012088688 (ProcID:0024904018) START AT   15.11.2024 / 10:24:54  **
**                                     UTC TIME   15.11.2024 / 09:24:54  **
**  TEXT="        Job started             "                              **
***************************************************************************
Aix variable OpenAR  : IT16_OpenAR.csv
Aix variable ClosedAR: IT16_ClosedAR.csv
Registered variable: 'T' NULL=IT16_OpenAR.csv
Registered variable: 'T' NULL=IT16_ClosedAR.csv
***************************************************************************
**  ucxja64m     version 21.0.9+build.1702489267437 changelist 1702489267  **
**  JOB 0012088688 (ProcID:0024904018) ENDED AT   15.11.2024 / 10:24:56  **
**                                     UTC TIME   15.11.2024 / 09:24:56  **
**  TEXT="        Job ended               "       RETCODE=00             **
***************************************************************************

THE RESULT IN POST-PROCESS :

2024-11-15 10:24:56 - U00020206 Variable '&CLOSEDAR_FILENAME#' was stored with value ''.
2024-11-15 10:24:56 - U00020206 Variable '&OPENAR_FILENAME#' was stored with value ''.
2024-11-15 10:24:56 - U00020408 We are in a Post Process
2024-11-15 10:24:56 - U00020408 Print Variable OA in Post-Process OPENAR_FILENAME   ->
2024-11-15 10:24:56 - U00020408 Print Variable OA in Post-Process CLOSEDAR_FILENAME ->

Ps: I set the variable UC_EXT_INTERPRETERS_UNIX with UNIXCMD .sh /bin/bash <FILE>

Thanks in advance.

Daryl Brown's profile image
Daryl Brown  Best Answer

I think you're supposed to leave off the leading '&' of your variable object in the :REGISTER_VARIABLE command, based on what I'm seeing in the documentation.

Does it work any better if you change those two lines to this?

:REGISTER_VARIABLE OPENAR_FILENAME#,$nome_file_OpenAR
:REGISTER_VARIABLE CLOSEDAR_FILENAME#,$nome_file_ClosedAR

MartaLorenzon606904's profile image
MartaLorenzon606904
Hi Daryl,
 
Thank you very much. You have resolved my issues.
 
Have a great weekend!