How can I use this shell command in control-m command line - control-m

How can I use shell command in control-m command line?
/Path/somescript.ksh 1>some.log 2>&1.
Thanks in advance

You can do it very easily like below:-
MEMLIB="/Path/" <!-- example "/usr/bin" -->
MEMNAME="somescript.ksh" <!-- example ls -->
<AUTOEDIT2 NAME="%%PARM1" VALUE="1>some.log"/>
<SHOUT DEST="xxx" MESSAGE="%%JOBNAME FAILED REVIEW DOC" URGENCY="U" WHEN="NOTOK"/>
<AUTOEDIT2 NAME="%%PARM2" VALUE="2>&1"/>
<SHOUT DEST="xxx" MESSAGE="*N*2 %%JOBNAME HAS FAILED, REVIEW DOC" URGENCY="V" WHEN="NOTOK"/>
Now in reality it will execute like:-
/Path/somescript.ksh 1>some.log 2>&1
Please let me know if you need any more help.

Related

How to programatically pass a value to an R prompt (creating keyring)

I wanted to be able to execute this code as part of an initial configuration for using R on a Ubuntu
library(keyring)
keyring_create("system")
But I am then prompted for a password. Entering it manually is of course of no problem, but I wanted to do it programmatically.. and was trying something like
echo "mypasswd" | Rscript -e "library(keyring); keyring_create("system")"
But no luck,
Doesn't have to be bash, it can be an R only solution.. does anyone can give me a tip?
Thank you in advance

use content of a file as subject with mailx in informatica PC

I am using a mailx command in informatica powercenter command task. Requirement is to use the content of a file that gets generated with every workflow run, as subject of the email. Issue is subject is a sentence and my command captures only the first word in that sentence stopping at the space. How to overcome this? Is there an alternate way to achieve this?
Sample content of the subject file that gets generated is something like this:
testSub="Today is Saturday"
command used in the command task:
. /Targetdirectory/subject.txt; cat /Targetdirectory/Filename.txt |mailx -s $testsub xxx.zzz#gmail.com
When I receive the email, subject shows up as "Today"
Thanks
Put $testSub in quotes.
. /Targetdirectory/subject.txt; cat /Targetdirectory/Filename.txt |mailx -s "$testsub" xxx.zzz#gmail.com

How to show output "dymanic" command in jupyter?

How to show output "dymanic" command in jupyter? For example bash command "watch".
I can print:
%%bash
watch ls
And I see nothing
Other example use !watch ls but in this case I get clutter in output.
What is the proper way to see output of this kind command?

How to make SFTP cozbatch return different error codes

I need to get different SFTP exit codes for each error. For instance 'no such file or directory' --> exit code=552 or 550 instead of returning 1.
I've tried the following and it did not work:
//A05FTP EXEC PROC=SFTPROC,COND=(0,NE)
//COPSFTP.MYSTDIN DD *
host="xpto.xpty.xptz"
lzopts mode=text
cd /home/apl/files/unl
ls
a=`ls | wc -l`
echo `$a`
echo $?
QUIT
//*
and the output in spool is:
cozsftp> lzopts mode=text
mode=text
cozsftp> lzopts mode=text
mode=text
cozsftp> cd /home/apl/files/unl
Ý09.807¨ Invalid command.
cozsftp> a= 1
CoZBatchÝI¨: returning rc=exitcode=1
Can anyone help me?
COZBATCH allows you to embed shell scripts into JCL, so you don't need to use BPXBATCH. BPXBATCH really is a poor utility. If you're using Co:Z then good for you it rocks.
If you want to run shell commands you need to use the ! escape character.
!echo $a
FWIW, SFTP always returns 1 on error. I'm not sure if you can change that. Errors should be logged in the sysout.
Your problem may simply be the echo `$a`. Try enclosing with quotes instead of tick marks.
More generally, if you want to do more detailed error checking, instead of using the SFTP procedure (SFTPROC), I think you'd do better to write yourself a simple script that you execute with BPXBATCH. The script would issue the same SFTP commands, but you could capture and redirect the output (STDOUT/STDERR) and based on the return value ($?) and any error messages, you could certainly detect all the unusual conditions you might want.

Using shebang in a spec file without it being a comment

I need to make a small wrapper script around the binary I'm packing in an RPM. That wrapper script needs to say "#!/bin/sh" at the top. But when I do that, the "#..." is treated like a comment. No, don't comment that.
Is there any way to use a predefined variable or escape sequence to make a shebang (on the first line)?
Here's my little code in the .spec file:
%build
echo #!/bin/bash > foobar
echo export LD_LIBRARY_PATH=/opt/foobar/foobar/lib >> foobar
echo /opt/foobar/lib/foobar >> foobar
echo exit $? >> foobar
... where the result of the 1st line in the %build cycle is simply "+ echo."
Must I take a different approach? If so, what approach?
Just coming back to my question.
Quote the hash-bang. 'nuff said.Thanks.

Resources