I want to execute a JCL step no matter what the RC of previous step is? - conditional-statements

There are 3 steps in my JCL:
STEP 1: process
STEP 2: NDM
STEP 3: DELETE OUTPUT after NDM
What I want to accomplish?
I want to execute STEP 3 no matter what the return code of step 2 is.
I tried this:
COND=(16,GT) and COND=(16,ST,STEP 2) but it's not doing what I want to do.

Using COND=EVEN has the potential pitfall that the STEP will run even if the previous step ABENDS. Coding COND=(0,GT,STEP2) should allow the step to run but not if there is an ABEND.
Alternately you could use IF/THEN/ELSE/ENDIF coding.
e.g.
//STEP2 EXEC PGM=NDM
//IF STEP2.RC >= 0 THEN
//STEP3 EXEC PGM=???
//ENDIF
or
//STEP2 EXEC PGM=NDM
//IF STEP2.RC GE 0 THEN
//STEP3 EXEC PGM=???
//ENDIF
i.e. either >= or GE can be used.
You may find this helpful IF/THEN/ELSE/ENDIF Statement Construct
or for the COND parameter COND Parameter

Try COND=EVEN on your final step’s EXEC statement.
From the documetnation:
COND=EVEN tells MVS to execute this job step EVEN IF a prior step in
the same job abends, unless the job is canceled by the MVS
operator.
There's also a COND=ONLY:
COND=ONLY tells MVS to execute this job step ONLY IF a prior step in
the same job abends.
Explanation of COND:
COND is fairly counter-intuitive. The description is:
If none of these tests is satisfied, the system executes the job step;
if any test is satisfied, the system skips the job step on which the
COND= parameter is coded.
So your COND=(16,GT) means "If 16 is greater than the return code from any previous steps, don't execute this step". So this step would only execute if ALL the previous steps finished with a RC > 16.
COND=(16,ST,STEP 2) is invalid - ST is not a valid condition. Valid tests are :
EQ - equal
LT - less than
LE - less than or equal to
NE - not equal
GT - greater than
GE - greater than or equal to
To make a step run, no matter what the condition codes from previous steps are, you could code COND=(0,GT), which means 'if 0 is greater than any previous return code (which it won't be), skip this step.'.
To be safe, you could code:
COND=((0,GT),EVEN)
as EVEN will cause this step to execute even if a previous step ABENDs.

Related

snakemake dry run for a single wildcard in order of execution

Is it possible to do a dry run for snakemake for a single wildcard, in the order of execution?
When I call a dry run, I get the following at the bottom:
Job counts:
count jobs
1 all
1 assembly_eval
5 cat_fastq
1 createGenLogDir
5 createLogDir
5 flye
5 medaka_first
5 medaka_second
5 minimap_first
5 quast_medaka_first
5 quast_medaka_second
5 quast_racon_first
5 racon_first
5 symLinkFQ
58
This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.
So I guess it would be useful to:
get the dry run commands for a single wildcard (except for the aggregate rules, obviously), after all, the only thing that differs among the commands of any of those rules is the wildcard in the input, output and param directives.
get the workflow printed in the order of execution, for enhanced visualisation.
I did not find a suitable option using snakemake -h, and I'd be looking for something that --rulegraph, does compared --dag, which is to avoid redundancy.
If there is no solution to this, or if the solution is too cumbersome, I guess I will suggest this as enhancement in their github page.
Here are some possible solutions:
You can specify a target file with the specific wildcard you want, e.g. snakemake -nq output_wc1.txt
If your wildcards are stored in a list/dataframe, limit to just the first. I frequently do this while developing, e.g. chroms = range(1,2) # was range(1, 23)
If you have a single job for each rule and dependencies are simple (A -> B -> C), the jobs should be listed in order of execution. This is not true when your workflow has concurrent or branching rules.
Have you also checked --filegraph and --summary?

After command usage in Tcl

So my understanding is that after command can be used to delay the execution of a script or a command for certain ms but when i execute the below command, the output is printed immediately
Command:
after 4000 [list puts "hello"]
Output:
hello
after#0
Question: Why was the output not delayed for 4s here?
That what you wrote works; I just tried it at a tclsh prompt like this:
% after 4000 [list puts "hello"]; after 5000 set x 1; vwait x
Did you write something else instead, such as this:
after 4000 [puts "hello"]
In this case, instead of delaying the execution of puts, you'd be calling it immediately and using its result (the empty string) as the argument to after (which is valid, but useless).
Think of [list …] as a special kind of quoting.
The other possibility when running interactively is that you take several seconds between running the after and starting the event loop (since the callbacks are only ever run by the event loop). You won't see that in wish of course — that's always running an event loop — but it's possible in tclsh as that doesn't start an event loop by default. But I'd put that as a far distant second in terms of probability to omitting the list word…

Groovy assertion script is executed twice within SoapUI

Hello I'm trying to do a simple groovy script in Soapui
I try to get a testcase property and increment it then save it.
when I run then script it increments it two times I don't know why. I tried different syntaxes but nothing seems to work up to now.
Here is a screenshot that shows my problem
here I run the test 2 times, first the variable was 3, normally when I run the test the second time the before value should be at 4 and the after at 5, and not 5 and 6.
I believe that you do not want to have the increment logic in Script Assertion.
Instead increment counter in the Setup Script of test case.
If you need the counter value in the script assertion, just read it alone.
Hope this helps.
By the way, I do not see any issue with script you have shown.
Check if there any where else if this variable is being manipulated.
def cnt = context.testCase.getPropertyValue('COUNT') as Integer
if (cnt< 10){
log.info "before : $cnt"
cnt += 1
log.info "after : $cnt"
context.testCase.setPropertyValue('COUNT', cnt.toString())
}
Can't comment yet. I'm seeing the same issue in 5.3.0 - here's my script that grabs a string value from properties, converts it to an Integer, increments it and sends back as a string.
loopsInt = messageExchange.modelItem.testStep.testCase.getPropertyValue("loops").toInteger();
log.info loopsInt;
loopsInt++;
log.info loopsInt;
messageExchange.modelItem.testStep.testCase.setPropertyValue("loops", String.valueOf(loopsInt));
I log the value before I increment, and immediately after, and as you can see, the value is being incremented twice. Here I run the script 3 times:
Thu Mar 16 12:04:54 NZDT 2017:INFO:52
Thu Mar 16 12:04:54 NZDT 2017:INFO:53
Thu Mar 16 12:04:56 NZDT 2017:INFO:54
Thu Mar 16 12:04:56 NZDT 2017:INFO:55
Thu Mar 16 12:04:59 NZDT 2017:INFO:56
Thu Mar 16 12:04:59 NZDT 2017:INFO:57
I get the same result whether I use loopsInt++ or loopsInt = loopsInt + 1. The "loops" property is not being used anywhere else. Weird.
When you execute the assertion script with the green arrow in Script Assertion Window, it is executed twice.
I have used the following script:
def loopsInt = messageExchange.modelItem.testStep.testCase.getPropertyValue("myNum").toInteger();
log.info loopsInt
loopsInt++
messageExchange.modelItem.testStep.testCase.setPropertyValue("myNum", String.valueOf(loopsInt))
See the following picture. One window logs even numbers and second the odd numbers.
Please note that execution in Script Assertion Window shall be utilized just for debugging of the script. When you execute the test case (test step), the script is executed only once, as expected.
Anyway, I think there are better places to set test case properties (setUp script, Groovy Script test step and others). I recommend to use assertion scripts for checking the message exchange.
Karel
Found a very strange reason for this.
If the testStep having this assertion is been run successfully [i.e., if SOAP test step, then it becomes green], and after this if you open the assertion and run it separately, then it's incremented twice. Once in your editor, once within the test step itself.
Say the testSetp had failed [is red in color], then you try running the assertion separately, it works absolutely fine.

Print only nonzero results using AMPL + Neos server

I'm doing a optimization model of a relatively big model. I will use 15 timesteps in this model, but now when I'm testing it I am only using 4. However, even with 11 time steps less than desired the model still prints 22 000 rows of variables, where perhaps merely a hundred differs from 0.
Does anyone see a way past this? I.e. a way using NEOS server to only print the variable name and corresponding value if it is higher than 0.
What I've tested is:
solve;
option omit_zero_rows 0; (also tried 1;)
display _varname, _var;
Using both omit_zero_rows 0; or omit_zero_rows 1; still prints every result, and not those higher than 0.
I've also tried:
solve;
if _var > 0 then {
display _varname, _var;
}
but it gave me syntax error. Both (or really, the three) variants were tested in the .run file I use for NEOS server.
I'm posting a solution to this issue, as I believe that this is an issue more people will stumble upon. Basically, in order to print only non-zero values using NEOS Server write your command file (.run file) as:
solve;
display {j in 1.._nvars: _var[j] > 0} (_varname[j], _var[j]);

Bamboo vs CxxTest

When I create a plan in Bamboo and add a task for running CxxTest test code(running function TS_ASSERT(1==1) or st). When I try to run for checking failure (TS_ASSERT(1==2)), this test case is fail and Bamboo output a log as:
12-Mar-2014 15:12:07 Failed 1 and Skipped 0 of 2 tests
12-Mar-2014 15:12:07 Success rate: 50%
12-Mar-2014 15:12:07 Failing task since return code was 1 while expected 0
So, does anyone here know why bamboo can understand the test result, and what is the return code here(return code was 1 while expected 0)?
From my observation, one windows, Bamboo consider value of the %ERRORLEVEL% as the result of the task. so return code was 1 while expected 0 means your task is returning 1 and Bamboo is expecting 0. Yes, it's expecting 0 since it considers any value other than 0 as failure.