How to execute TSO commands in Batch Job

Running TSO commands via batch job can be very useful if you have the need to execute multiple commands or if you want to capture the output of the TSO commands.

To execute the TSO commands in batch you can use one of the following Terminal Monitor Programs (TMP):

  • IKJEFT01
  • IKJEFT1A
  • IKJEFT1B

The JCL below is an example:

//TSOCMDS   EXEC PGM=IKJEFT01
//SYSEXEC   DD DUMMY
//SYSTSPRT  DD SYSOUT=*
//SYSPRINT  DD SYSOUT=*
//SYSTSIN   DD *
  RLIST TAPEVOL ADC700
  LU USERABC
  LISTC ENT('USERABC.JCL.CNTL')
//

 

Which Terminal Monitor Program (TMP) should you use? Well, that depends… Below are the differences between the 3 of them:

  • IKJEFT01:
    • When a command completes with a non-zero return code, the program goes to the next command.
    • When a command abends, the step ends with a condition code of 12.
  • IKJEFT1A:
    • If a command or program being processed ends with a system abend, the job step terminates with an S04C system completion code. IKJEFT1A also returns the completion code from the command or program in register 15.
    • If a command or program being processed ends with a user abend, the completion code is saved in register 15 and the command or program terminates.
    • If a command, program or REXX exec being processed returns a non-zero return code, IKJEFT1A saves the return code in register 15 and then terminates. Non-zero return codes to IKJEFT1A from CLISTs will not affect the contents of register 15 and the TMP will continue processing.
    • For a non-zero return code or an abend from a command or program that was not given control directly by IKJEFT1A, no return code is saved in register 15 and IKJEFT1A does not terminate.
  • IKJEFT1B:
    • If a command or program being processed ends with a system or user abend, IKJEFT1B causes the job step to terminate with an S04C system completion code. IKJEFT1B also returns the completion code from the command or program in register 15.
    • If a command, program or REXX exec being processed returns a non-zero return code, IKJEFT1B saves this return code in register 15 and then terminates. Non-zero return codes to IKJEFT1B from CLISTs will not affect the contents of register 15 and the TMP will continue processing.
    • For a non-zero return code or abend completion code from a program or command that was not given control by IKJEFT1B, no return code is saved in register 15 and IKJEFT1B does not terminate.

4 Comments

  1. Hi Katja,

    Yes, there is. Roughly, the steps to achieve what you want are:

    1. Insert a line with the string that you want to add
    2. In the lines where you want to insert your string you must move the text to the right; you can do this by using the )) in the first line and ))xx in the last (xx is the number of columns you want to move).
    3. Do a C (for copy) or M (for move) in the line where your string is
    4. Do a oo on the first and last line where you want to add the string and press enter

    Your lines should now have the string at the start as you wanted.

  2. Is there any way to insert a specific string at the begin of many lines at same time with ISPF? Thanks

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.