Oops. I spoke too soon. If the value you want to insert with PUT_ATT comes from an object variable, it doesn’t appear to work. Here is my updated SEC_SQLI.
https://us.v-cdn.net/5019921/uploads/FileUpload/27/1761274944c48707bfebdef2531091.png" width="751">
In an earlier job in the workflow, I fill a VARA will the three-character project prefixes in the keys. These project prefixes are the unique identifiers of the individual projects that use the Automation Engine. All jobs and workflows owned by a project must begin with the project’s own three-character prefix. This is why bind parameter two has the % sign at the end. The query searches for objects of a certain type (JOBP or JOBS) whose names begin with the project prefix.
Here is the SCRI that is supposed to populate value 1 and 2 in the VARA with the data retrieved from the query (the number of workflows and jobs in each project, respectively).
:PRINT "Fetching number of workflows and jobs for each project."
!If project list VARA does not exist, exit
:IF GET_OH_IDNR(&PROJECT_LIST_VARA#) = 0
: PRINT "Project list VARA &PROJECT_LIST_VARA# does not exist."
: MODIFY_STATE RETCODE=50
:ELSE
! Open VARA and fill in stats
: SET &VaraHnd# = PREP_PROCESS_VAR(&PROJECT_LIST_VARA#,,,)
: PROCESS &VaraHnd#
: PSET &PROJECT# = GET_PROCESS_LINE(&VaraHnd#, 1)
: PUT_ATT ARCHIVE_KEY1 = "&PROJECT#"
!: PUT_ATT ARCHIVE_KEY1 = "UC0"
! Process JOBP objects
: PSET &OBJECT_TYPE# = "JOBP"
: PUT_ATT ARCHIVE_KEY2 = "&OBJECT_TYPE#"
!: PUT_ATT ARCHIVE_KEY2 = "JOBP"
: SET &WORKFLOW_COUNT# = GET_VAR(UC0.MAL.GET_OBJECT_COUNTS.SEC_SQLI2)
! Process JOBS objects
: PSET &OBJECT_TYPE# = "JOBS"
: PUT_ATT ARCHIVE_KEY2 = "&OBJECT_TYPE#"
!: PUT_ATT ARCHIVE_KEY2 = "JOBS"
: SET &JOB_COUNT# = GET_VAR(UC0.MAL.GET_OBJECT_COUNTS.SEC_SQLI2)
: PRINT "Project &PROJECT# has &WORKFLOW_COUNT# workflows and &JOB_COUNT# jobs."
: PUT_VAR &PROJECT_LIST_VARA#,&PROJECT#,&WORKFLOW_COUNT#,&JOB_COUNT#
: ENDPROCESS
: CLOSE_PROCESS &VaraHnd#
:ENDIF
The GET_VAR commands work if the preceding :PUT_ATT command has a hard-coded value. It always returns a value of 0 if the preceding :PUT_ATT contains an object variable like &PROJECT#.
Here’s an excerpt from the activation report:
2014-02-14 17:36:15 - U0020408 Fetching number of workflows and jobs for each project.
2014-02-14 17:36:15 - U0020230 Value '&PROJECT#' in object: 'UC0.MAL.GET_OBJECT_COUNTS.SCRI.AK', line: '00016' (RunID: '0005307954') was changed from '' to ' ABC' using the command :PSET.
2014-02-14 17:36:15 - U0020206 Variable 'PROJECT#' was stored with value ' ABC'.
2014-02-14 17:36:15 - U0020230 Value '&OBJECT_TYPE#' in object: 'UC0.MAL.GET_OBJECT_COUNTS.SCRI.AK', line: '00022' (RunID: '0005307954') was changed from '' to 'JOBP' using the command :PSET.
2014-02-14 17:36:15 - U0020206 Variable 'OBJECT_TYPE#' was stored with value 'JOBP'.
2014-02-14 17:36:15 - U0020230 Value '&OBJECT_TYPE#' in object: 'UC0.MAL.GET_OBJECT_COUNTS.SCRI.AK', line: '00028' (RunID: '0005307954') was changed from 'JOBP' to 'JOBS' using the command :PSET.
2014-02-14 17:36:15 - U0020206 Variable 'OBJECT_TYPE#' was stored with value 'JOBS'.
2014-02-14 17:36:15 - U0020408 Project ABC has 0 workflows and 0 jobs.
Every line from the Object access report looks the same:
GET_VAR UC0.MAL.GET_OBJECT_COUNTS.SEC_SQLI2 0 (default)
If I uncomment the lines that run :PUT_ATT with hard-coded values, the GET_VAR works.
I see three possible explanations:
- :PUT_ATT is simply not working when an object variable is provided in the value.
This doesn’t seem likely, because I know I have provided values to :PUT_ATT before using object variables or script variables.
- :PUT_ATT is somehow being executedbeforethe object variable has been set.
This also doesn’t seem likely. I have done some simple tests, and :PUT_ATT does not appear to work this way.
- GET_VAR is being executed before either the object variable has been set or before the :PUT_ATT has been run, or both.
This seems the most likely explanation, but I don’t see any reason why it would work this way.*
* My previousabout the :RESOLVE statements in the workflow extended Script report appearing was probably a red herring — the :RESOLVE statements for the task GET_VARs disappeared from the workflow Script report as soon as I switched onGenerate at runtime. That was obviously an oversight on my part. Checking that check-box eliminated the :RESOLVE messages, but the odd behavior with GET_VAR remains.