Trying to bypass an error when trying to execute a REXX or TSO command in batch enviroenment

What I'm trying to do is executing a TSO command from within a COBOL program executing in Batch environment; what I do first is to create a TSO environment calling IKJTSOEV; after successful completion (RETURN CODE=0) I use TSOLNK routine to execute a TSO command.

The problem arises in this second call, I get ikj56637I error. If I consult IBM manual, it says :

IKJ56637I You attempted to run a command, program, CLIST, or REXX exec from an authorized environment. This is not supported under the dynamic TSO/E environment. Explanation: You are running in an address space with a TSO/E environment created by the TSO/E environment service. You asked to use the TSO/E service facility to invoke a command, program, CLIST, or REXX exec from an authorized TSO/E environment. This function is not available in this environment.

May I receive some explanation about what is happening and how can I manage to solve this and have my COBOL program executed?.

Many thanks in advance

Upvotes: 0

Views: 814

Answers (2)

Machnik
Machnik

Reputation: 1

You are getting that error because your program appears to be APF authorized. What are you trying to accomplish in TSO from an authorized environment?

If authorization is intentional, do you simply need to issue the command or do you need to check a return code from command?

You could submit JCL to the internal reader or get back to problem state, issue the command, and authorize again.

Upvotes: 0

Bruce Martin
Bruce Martin

Reputation: 10543

Do you really need to run TSO from Cobol ???

If you do try:

  • Running the Cobol program from Batch TSO - ISPF then use ISPF services to call TSO.

This should work but there is probably a better way. Just running your Cobol program under TSO may work.

I am not sure that running lots of TSO steps in a Cobol program is a good idea. An alternative approach like:

  • Cobol program writes details to a fileA
  • TSO Rexx program reads the fileA runs the command and writes to fileB
  • Second Cobol program reads fileB

might work better.


For running ISPF batch Google ISPF Batch, you will find responses like Batch Ispf

//USERAA   JOB (ISPF),'ISPF USER',MSGCLASS=X,
//         CLASS=A,NOTIFY=&SYSUID
//*
//ISPFSTP  EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=32M
//ISPPROF  DD RECFM=FB,LRECL=80,SPACE=(TRK,(2,2,2))
//ISPLLIB  DD DSN=USERA.LOADLIB,DISP=SHR
//ISPMLIB  DD DSN=ISP.SISPMENU,DISP=SHR
//ISPPLIB  DD DSN=ISP.SISPPENU,DISP=SHR
//ISPSLIB  DD DSN=ISP.SISPSENU,DISP=SHR
//         DD DSN=ISP.SISPSLIB,DISP=SHR
//ISPTLIB  DD RECFM=FB,LRECL=80,SPACE=(TRK,(1,0,1))
//         DD DSN=ISP.SISPTENU,DISP=SHR
//ISPCTL1  DD SPACE=(CYL,1),RECFM=FB,LRECL=80
//ISPLOG   DD SYSOUT=*,RECFM=FB,LRECL=133
//SYSEXEC  DD DSN=ISP.SISPEXEC,DISP=SHR
//SYSPROC  DD DSN=ISP.SISPCLIB,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN  DD *
  ISPSTART pgm(cobolPgm)

In your program you would use the ISPF SELECT CMD service to call TSO. The ISPF Edit command model will generate a sample ISPF calls for you.

Basically In cobol you would do

CALL 'ISPLINK' USING SELECT Command-Var

where command-var holds 'CMD(Your-command)'

This thread has a Cobol program calling ISPF

Upvotes: 1

Related Questions