Rexx code to change word in jcl and submit - jcl

Rexx code to change word in jcl and submit.
There is a JCL code. Requirement is to run the job after doing "C ALL JOB1 JOB2".

There are several ways of doing it. I would suggest ISPF skeltons
ISPF Skelton
The rexx is
ADDRESS TSO "ALLOC DD(OUTSKEL) DS('"OUTSKPDS"') SHR"
job="job2" /* job1 */
'FTOPEN'
'FTINCL SAMPSKEL'
'FTCLOSE LIBRARY(OUTSKEL) NAME('WORKMEM')'
The Skeleton becomes
//&job. job
see Executing a DFSORT using REXX
Edit Macro
You could use an edit macro. The rexx
'address ispexec edit dataset(my.job.to.edit) macro(mymacro)'
and the macro is roughly
address isredit 'macro'
address isredit 'c job1 job2 all'
address isredit 'sub'
Read/write
Jou could read the JCL line by line, change each line as required and write a new JCL dataset file

Related

How to change primary command in Edit

I want to add some shortcuts in ISPF Edit.
For instance, I'd like to type T for "TOP" and B for "BOT". How can I do this? I tried to enter
define t alias top
in the command line, but it didn't work: I have "COMMAND TOP NOT FOUND" if I use the shortcut.
How can I achieve this? And how to have this shortcut available each time I open Edit?
A flexible solution would be to create an initial edit macro that does double duty. On first invocation as the initial edit macro, it defines commands such as T and B as aliases to itself. These commands then cause ISPF to invoke the same macro and perform the appropriate action. For this, use the ISPF variable ZEDTMCMD as the main logic driver; it is set by the editor with the command that invoked the macro.
Here is a very general REXX solution called MYMACRO:
/* REXX */
address 'ISREDIT'
parse source . . s3 .
'MACRO' /* You can specify optional arguments if you want */
/* Easier to work with upper case and no leading or trailing blanks */
address 'ISPEXEC' 'VGET (ZEDTMCMD)'
invoke_cmd = translate(strip(zedtmcmd))
select
when invoke_cmd == s3 then do /* first time call */
'DEFINE T ALIAS' s3
'DEFINE B ALIAS' s3
end
when invoke_cmd == 'T' then 'UP MAX'
when invoke_cmd == 'B' then 'DOWN MAX'
otherwise nop
end
exit 0
Next, specify MYMACRO as a initial edit macro. This can be specified in several places, but the easiest is on the main edit panel (option 2).
Note that your macro needs to be in the standard lookup (DD SYSEXEC, SYSPROC, or DD SYSUEXEC or SYSUPROC if ALTLIB is active, or ISPCLIB) to be found.
If you decide to write a program, it is a little bit more complicated. You have to:
prefix the name in the initial edit macro field with an exclamation point ! so ISPF knows to invoke it as a program rather than a script (this means 7 characters maximum for the name);
remove the leading exclamation point before executing the SELECT;
and add 'DEFINE MYMACRO MACRO PGM' as the first line in the first time call logic, so ISPF knows that it is a program, not a script.
In this scenario, when executed as the initial edit macro, ZEDTMCMD will have the leading exclamation point.
By creating one macro, you can make it easier to add new commands in the future.
The ISPF installation SAMPLIB (usually named ISP.SISPSAMP, but it may be different at your installation) has several example macros, all beginning with ISR*. There are REXX scripts, CLISTs, COBOL, and PL/I examples. (No assembler, but creating one is a trivial exercise.)
TOP and BOTTOM are commands in the ISPF command table. They are not EDIT commands. They are ALIAS's for UP MAX and DOWN MAX. An ISPF command must be at least 2 bytes in length, so you can not create a new ALIAS in the command table for UP MAX using a 1 byte character.
You can define an Edit macro called T. The macro could do something like
/* REXX */
address ISREDIT "MACRO"
address ISREDIT "LOCATE 0"
exit(0)
B for BOTTOM could be
/* REXX */
address ISREDIT "MACRO"
address ISREDIT "LOCATE .ZLAST"
exit(0)
Note that B would put you on the last line and not the last full page like BOTTOM actually does. For TOP and BOTTOM I would personally just use PF7 or PF8 with M on the command line to do the max scroll. Its just 1 character with a PFKEY as opposed to the enter key.

CMD, REXX, need a way to detect an error

I'm very very new to programming/coding.
And I have a very specific question, which I didn't find any answers to.
This command below executes perfectly fine if the command is valid.
If I enter an invalid command, an error occurs and the cmd exits.
enter image description here
But how do I make it, if an error happens, the program starts from the beginning rather than the cmd window closes?
So, in short, I want "SIGNAL start" to happen if an error occurs.
I hope you understand, thank you very much.
other:
SAY "Enter your own command:"
PULL command
command
IF command=ERROR THEN DO
SIGNAL start
It would be helpful if you published all of your code but it seems that what you really need to do is code a loop.
/* REXX */
do forever
say "Enter a command"
pull command
"where" word(command,1)
if rc <> 0 then iterate
command
end

How do I enter P4 triggers from standard input on Windows

I need to set the table to perforce triggers from the command line on Windows 8.
I am entering the following command and pressing "enter":
C:\Program Files\Perforce>p4 -H localhost -p 1666 -u Administrator -P ** triggers -i
Text cursor moves to a new line as if it awaits the trigger lines. Good so far. I input triggers one by one and when I am done, I have no idea how to tell p4.exe to "flush" my input and save it. What is the correct way of setting triggers in my situation?
Omit the -i and things are much easier: Perforce will bring up your P4EDITOR, which is Notepad by default I think, and you can edit your trigger table in Notepad and then save it.
The -i option allows you to "Read the trigger table from standard input without invoking the editor". The keyword here is table. You have to enter the entire trigger table, in its proper format, not just your triggers. The trigger table starts with a line that contains the following...
Triggers:
...followed by "a list of triggers; one per line. Each trigger line must be indented with spaces or tabs in the form. Each line has four elements..."
So, entering the trigger table from the command line might look something like this (I'm just entering a single trigger in this example):
C:\>p4 triggers -i
Triggers:
example change-submit //depot/... "cmd %changelist%"
C:\>
The sequence is...
"Triggers:" Enter Tab [trigger line] Enter Tab [trigger line] Enter...
...until you are done entering all of your triggers. When you are done, hit Ctrl+C to "flush" your input and save it.

How to call a macro script in qtp and to run that macro script in excel

I have a created a macro script by recording in excel. Now I need to run this macro script in newly opened excel via QTP (Vb script) . Can anyone suggest me , what call function can be used in qtp to run this macro script in excel?
my macro script is
Sub csi()
' csi Macro
' Keyboard Shortcut: Ctrl+c
ActiveCell.FormulaR1C1 = "test test test "
Range("B1").Select
End Sub
As explained as an answer to a similar question it is not very difficult:
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "test.xls!csi"
or
objExcel.Application.Run "test.xls!sheet1.csi"
Depending if the macro resides in a module or in a sheet.

Properly invoking an interactive script from elisp

I have an external command line program that I would like to invoke from elisp. This is easy enough with shell-command, but it doesn't work correctly when the command line program is interactive, which in my particular case it is: The invoked script sees EOF when it reads stdin when I call it like this:
;; upload command is a string with the name of
;; a python script and some args
(shell-command upload-command
(get-buffer-create "*upload output*")))))
The python script identified by upload-command may ask some yes/no questions and it may prompt for a password, for which I'd like masked input. Ideally, all of this interaction would occur within the minibuffer.
How can I arrange things so that my external interactive command interacts with the user via minibuffer when called via elisp?
The easiest way is to use either make-comint or make-comint-in-buffer:
(make-comint-in-buffer "upload-script-process" "*upload output*" upload-command)
This will runs the script in a buffer like a shell buffer, so it doesn't fulfill the requirement of having all interaction happen in the minibuffer. It will, however, automatically read passwords in masked form from the minibuffer, provided the password prompt matches comint-password-prompt-regexp.
Note that upload-command in this example here needs to be the name of an executable file on exec-path. Any extra switches or other arguments to the script have to be passed as string arguments to make-comint:
(make-comint-in-buffer "upload-script-process" "*upload output*"
upload-command nil "--verbose" "--other-option")
See the Emacs documentation for more details.