Datastage:Split Parameter value - parallel-processing

I have a parallel job with parameter value "202203011537". I want to split this parameter value as "20220301" and "1537" and use it in SQL stage. Is there a way we can do it in Datastage parallel job?

If you add Environment Variable in job properties?
In this case, if you set a variable, you will can call a cuostom routine that calculated the split value.

Related

Call user defined variable in another variable

Is it possible to call a user defined variable within another user defined variable? For example, in the screenshot below I would like to call the variable 'CmsVersion' value in 'ResultsPath'. Right now it is outputting ${CmsVersion} as the folder name and not the variable value.
You cannot, at least not within the bounds of a single User Defined Variables configuration element.
It is possible if you add another User Defined Variables below your original one, this way you will be able to reference the variables define in the above configuration element in the one(s) which is (are) below:
Demo:
More information: Using User Defined Variables
Variables declared in the same User defined variables config element cannot be reused in the same element. You can move it to Test Plan level as per screenshot below
In your case you will need to do another special handling because you are dealing with a windows folder path. the \ is escape character in JAVA. When you say \${CmsVersion} JAVA is treating \$ as an escape sequence.
I have declared 2 variables CmsVersion correlated within the same config element and CmsVersion1 correlated from Test Plan variable.
Result is as below in Debug Sampler

JMeter retrieve value of value

I am using jmeter to test ldap.
As part of my test, I want to search for a random uid on each iteration. I did not find a straight forward answer to this. So my idea was to first select a random number 1-200 and saving that number as a variable named uid, that number would correspond to a UDV name.
For example
uid = 2 and 2 = A123456
in my udv list. However when trying to reference this variable in my ldap search filter.I am trying to use
(uid=${${uid}})
in hopes to get the value of the value of uid. However the search results just show this as a string.
<searchfilter>(uid=${${uid}})</searchfilter>
Is there another way to achieve what I am looking for?
Use __V function
${__V(${uid})}
The V (variable) function returns the result of evaluating a variable name expression. This can be used to evaluate nested variable references
${__V(A${N})} - works OK. A${N} becomes A1, and the __V function returns the value of A1
Perhaps the easiest would be going for __RandomFromMultipleVars() function?
Another option is using __V() function, it can combine and evaluate JMeter Variables

Reseting "Thread Context"

I would like to know if it is possible to reset the thread context (all of its variables) at the begining of a new iteration.
The problem that I am having is that the thread keeps all the variables (and its values) from its previous iterations and sometimes it things can get messy.
If I am not mistaken, on VisualStudio Performance tests you can specify the percentage of "new users" to indicate how many VirtualUsers are going to have its contexts reseted on their next test iteration.
Do we have something similar native on JMeter or do we need to write some code to do it?
Thanks in advance!
I'm not sure you really want/need it, but you can remove all JMeter variables using JSR223 script with remove method:
for (Map.Entry entry : vars.entrySet()) {
vars.put(entry.getKey(), null);
}
It depends on the type of variables you create and how you use them.
For ex:
Regular Expression Extractor
Here It creates a variable regex.var and if the response matches the expression it will have some value assigned to it. If the next iteration does not match the expression, It will still keep the previous iteration value. To avoid this problem, assign a default value or check the 'Use empty default value'. so that every iteration will basically reset the value.
User Designed Variables - Each and every thread will have its own copy of the variable and threads could be modifying its variable value throughout the entire duration of the test. If you want that to be reset for every iteration, it is completely your responsibility.
I think this could be helpful.
JMeter - Understanding Variables Scope

JMeter-what is difference between use ${} or vars.get() to get value of variable

Today when I was debugging my JMeter script, I found a problem that confused me a lot.
CSV Data Config element: in CSV, I set variable userId to 1001200
Then run script below, and get different value of "userId" when using ${userId} and vars.get("userId"). I think they should be same value, but it seems not. After run vars.put("userId", "-111"), ${userId} and vars.get("userId") get different values:
so it seems ${} and vars.get() have some difference even though their variable is same, does anyone know the reason?
Thanks in advance.
Yes, you need to follow best practices when scripting and avoid using ${value}
When using JSR 223 elements, it is advised to check Cache compiled script if available property to ensure the script compilation is cached if underlying language supports it. In this case, ensure the script does not use any variable using ${varName} as caching would take only first value of ${varName}. Instead use :
vars.get("varName")
Answer provided by #user7294900 refers to the case when Cache compiled script option is checked. But even if it's not checked, your script will resolve variables defined as ${varName} before execution, while vars.get("varName") is resolved during execution.
Before JMeter is about to run any element (sampler, pre- or post-processor), it will take (every) text field and will resolve any variables, functions or inline code, identified by ${...} to their values available at the time of the evaluation. Thus syntax ${...} converts variable into a constant string and your code (for Groovy or any other execution engine) will look like this:
log.info("***" + "1001200" + "***");
log.info("***" + vars.get("userId") + "***");
vars.put("userId", "-111");
log.info("***" + "1001200" + "***");
log.info("***" + vars.get("userId") + "***");
Thus no matter how you change variable during execution, it won't change since it's no longer a variable. But vars.get("userId") on the other hand, is a function call and will check variable value every single time.

meaning of auto_hold variable in JIL files

In Autosys JIL file, i would like to know the meaning of the variable auto_hold. And when giving auto_hold: 1, what it is meant?
The auto_hold attribute denotes whether a job should automatically be put in the ON_HOLD status when the box it is in starts. The value of 1 means it should be put ON_HOLD, where a value of 0 means it should not.
If the job is not in a box, this attribute is not used.

Resources