Page 1 of 1

Execute job from cobol program

PostPosted: Sun Mar 21, 2010 7:22 pm
by Galbi
Hi to all,

Is it possible to launch a jcl job from a cobol program?

Flavio

Re: Execute job from cobol program

PostPosted: Sun Mar 21, 2010 9:19 pm
by dick scherrer
Hello,

Yes, dynamically create the JCL and "write" the new/modified JCL to the internal reader. More often the system scheduling software is used rather than including this in application code.

Ask your support for the proper definition of an internal reader DD statement for your system. Specifics can vary from system to system.

Re: Execute job from cobol program

PostPosted: Tue Mar 23, 2010 12:25 am
by ctrevino
Also, if you have CICS and it is an online program (big ifs), you can do the following:

EXEC CICS ENQ RESOURCE (INTRDR-NAME) LENGTH(INTRDR-LGTH)
     END-EXEC                                           
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL01)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL02)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL03)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL04)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL05)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL06)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL07)   
    LENGTH(80)  END-EXEC                               
EXEC CICS WRITEQ TD QUEUE(INTRDR-NAME) FROM(WS-JCL07)   
    LENGTH(80)  END-EXEC                               
EXEC CICS DEQ RESOURCE (INTRDR-NAME) LENGTH(INTRDR-LGTH)
     END-EXEC                                           

Re: Execute job from cobol program

PostPosted: Thu Oct 07, 2010 4:03 pm
by Galbi
My system is OS/390 IBM mainframe.

I know than is able launch the task jcl by cics cobol program (transient data, etc etc).

i'm sure It is able to execute a jcl in cobol batch but I haven’t an example or a manual who explain how to build this.

If you have a suggestion …

Thank’s a lot

Re: Execute job from cobol program

PostPosted: Thu Oct 07, 2010 11:29 pm
by dick scherrer
Hello,

Environments that permit/support user-submitted jobs from online cics transactions already have the internal reader defined.

You need to speak with your peers or technical support people to learn if this available on your system and how it is to be done. This is completely site-specific.

Re: Execute job from cobol program

PostPosted: Fri Oct 08, 2010 7:09 pm
by Galbi
The problem solution it’s a IEBGENER.

i builded a cobol program, inside I wrote the jcl for the FTP transfer to the server of the file.

When the program finish the elaboration, the file created, with the jcl, it’s a input to a IEBGENER

//SYSUT1 DD dsn=file.name.with.jcl,disp=shr

The SYSUT2 is dummy, but, and this is solution key, inside the job there is a SYSOUT card with the parameter who indicate the execution class and the initiator reader

//SYSOUT DD SYSOUT=(B,INIRDR)

At the end of the job the new job start

The job example:

//*--------------------------------------------------------------------*
//*--- ESECUZIONE DELL'FTP
//*--------------------------------------------------------------------*
//FTP EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DSN=file.name.with.jcl,DISP=SHR
//SYSUT2 DD SYSOUT=(X,INTRDR)

A consideration, inside the cobol program I used the dynamic allocation and managing of the files, the same file who I want to transfer to server.

Bye bye

Re: Execute job from cobol program

PostPosted: Sat Oct 09, 2010 1:37 am
by dick scherrer
Hello,

Is this a question or are you explaining your "ftp" job?

The posted jcl will submit a job via the internal reader, but there is no ftp indicated. . .

Probably, i misunderstand something . . . :?