Execute job from cobol program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Execute job from cobol program

Postby Galbi » Sun Mar 21, 2010 7:22 pm

Hi to all,

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

Flavio
Galbi
 
Posts: 5
Joined: Sun Mar 21, 2010 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Execute job from cobol program

Postby dick scherrer » Sun Mar 21, 2010 9:19 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Execute job from cobol program

Postby ctrevino » Tue Mar 23, 2010 12:25 am

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                                           
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Execute job from cobol program

Postby Galbi » Thu Oct 07, 2010 4:03 pm

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
Galbi
 
Posts: 5
Joined: Sun Mar 21, 2010 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Execute job from cobol program

Postby dick scherrer » Thu Oct 07, 2010 11:29 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Execute job from cobol program

Postby Galbi » Fri Oct 08, 2010 7:09 pm

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
Galbi
 
Posts: 5
Joined: Sun Mar 21, 2010 4:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Execute job from cobol program

Postby dick scherrer » Sat Oct 09, 2010 1:37 am

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 . . . :?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post