IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To submit JCL via a Cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top