Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To submit JCL via a Cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vidyasaraswathi

New User


Joined: 10 May 2005
Posts: 72

PostPosted: Mon Jul 04, 2005 7:33 pm    Post subject: To submit JCL via a Cobol program
Reply with quote

I coded a COBOL program with filename OUT-JCL which is assigned to OJCL. Defined a record lay out as 80 bytes. Opened the OUT-JCL file in the output mode.


COBOL Code is as follows:
--------------------------------
FILE-CONTROL.
SELECT OUT-JCL ASSIGN TO OJCL.

DATA DIVISION.

FILE SECTION.
FD OUT-JCL
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
DATA RECORD IS IN-JCL-BUFFER.

01 OUT-JCL-BUFFER PIC X(80).


I want to submit the following JCL (which is stored in my PDS) from the COBOL program.

//OJCL JOB (T,B0,xxx),'xxxxx',CLASS=S,MSGCLASS=Y,
// REGION=0M,
// MSGLEVEL=(1,1)
//*------------------------------------------------------
//PS010 EXEC PGM=SORT
//*------------------------------------------------------
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=DSN1,DISP=SHR
//SORTOUT DD DSN=DSN2,
// DISP=(NEW,CATLG,DELETE),
// UNIT=WORK,SPACE=(TRK,(1000,100),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=NONE
/*


--------------------------------------------------------------------

To run the COBOL program, I wrote a JCL as follows,
//PS010 EXEC PGM=pgmname
//*----------------------------------------
//SYSOUT DD SYSOUT=*
//OJCL DD DSN=B052VAP.VSAMPLE3.OUT,
// SYSOUT=(*,INTRDR)
/*





But, my first JCL is not submitted via COBOL program and DSN2 is not created.

Can any one please help me to correct this?
Back to top
View user's profile Send private message

jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Mon Jul 04, 2005 10:15 pm    Post subject:
Reply with quote

you have to use your tobe submitted JCL as an input to the cobol program.

so program becomes

File in
File out

==> perform until eof-input
read input.
write output from input.
end-perform

close both the files.
goback.

JCL//--
//step1 exec pgm = sample
//filein dd disp=shr,dsn=abcd.tobe.submitted
//fileout dd sysout=(a,intrdr)
//sysprint dd sysout=*

this would workout

the jcl in "abcd.tobe.submitted" will be submitted
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jul 04, 2005 11:40 pm    Post subject:
Reply with quote

Hi vidy,

You could have saved yourself some time and coding by using sort or some such to copy the PDS info to intrdr.

//s1 sort
//sortin dd dsn=....
//sortout dd sysout=(*,INTRDR)
//sysprint dd sysout=*
//sisin dd *

sort fields=copy
Back to top
View user's profile Send private message
vidyasaraswathi

New User


Joined: 10 May 2005
Posts: 72

PostPosted: Tue Jul 05, 2005 12:05 pm    Post subject: Re: To submit JCL via a Cobol program?
Reply with quote

Hi,
I changed my COBOL program as mentioned by jz1b0c.
It worked fine. Thank you very much.

Thanks,
Vidya Bhat
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us