MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Writing JCL in Cobol Program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Sridhar Reddy
Beginner


Joined: 17 Feb 2003
Posts: 6
Topics: 3

PostPosted: Mon Feb 17, 2003 7:40 am    Post subject: Writing JCL in Cobol Program Reply with quote

How to write JCL in Cobol program. If you can provide me with an example that will help me a lot.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Feb 17, 2003 7:49 am    Post subject: Reply with quote

Sridhar Reddy,

Code:

01 JCL-STATEMENT-AREA.
   05  JCL1.                                                         
       10  FILLER          PIC X(18)  VALUE               
           '//JOBNAME JOB 0,'''.                   
       10  FILLER          PIC X(07)  VALUE 'NOTIFY'.
       10  JCL-JOBNAME     PIC X(08)  VALUE SPACES.                   
       10  FILLER          PIC X(45)  VALUE
           ',MSGCLASS=Y,CLASS=D                        '. 
       10  FILLER          PIC X(02)  VALUE SPACES.

          .....N NUMBER OF JCL STATEMENTS.

01 OUTFILE-REC       PIC X(80) VALUE SPACES.

01 W-SUB               PIC 9(3) value + 0.

PROCEDURE DIVISION.

PERFORM VARYING W-SUB FROM 1 BY 1 UNTIL W-SUB >  N 
        MOVE JCL-STATEMENT(W-SUB) TO OUTFILE-REC
        WRITE FILE-REC
END-PERFORM.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Mon Feb 17, 2003 7:59 am    Post subject: Reply with quote

Kolusu,

Is sit possible to submit this JCL through the same same Cobol program?

Diba
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Feb 17, 2003 9:21 am    Post subject: Reply with quote

Dibakar,
You can write the jcl to an output file pointing to INTRDR which will submit the jcl.

Code:

IDENTIFICATION DIVISION.
PROGRAM-ID.  SUBJCL
INPUT-OUTPUT SECTION.
FILE-CONTROL.
       SELECT OUTPUT-FILE
              ASSIGN TO OUTPUT.
FILE SECTION.

FD   OUTPUT-FILE
   RECORD CONTAINS 80 CHARACTERS
   LABEL RECORDS ARE OMITTED
   DATA RECORD IS OUTPUT-REC.

01   OUTPUT-REC      PIC  X(80).

WORKING-STORAGE SECTION.
01   W-SUB               PIC  9(03).

PROCEDURE DIVISION.

PERFORM VARYING W-SUB FROM 1 BY 1 UNTIL W-SUB >  N 
        MOVE JCL-STATEMENT(W-SUB) TO OUTPUT-REC
        WRITE OUTPUT-REC
END-PERFORM
         
CLOSE OUTPUT-FILE



In the jcl code it as

Code:

//STEP1 EXEC PGM=SUBJCL
//*
//OUTPUT DD SYSOUT=(A,INTRDR)


This JCL will be submitted upon closing of the file.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Mon Feb 17, 2003 9:25 am    Post subject: Reply with quote

Thanks kolusu!
Diba
Back to top
View user's profile Send private message Send e-mail
Sridhar Reddy
Beginner


Joined: 17 Feb 2003
Posts: 6
Topics: 3

PostPosted: Fri Feb 21, 2003 3:43 am    Post subject: Reply with quote

Thanks Kolusu

Sridhar
Back to top
View user's profile Send private message Yahoo Messenger
haseen_mohammed
Beginner


Joined: 20 Feb 2006
Posts: 27
Topics: 14

PostPosted: Mon Feb 20, 2006 10:30 am    Post subject: Reply with quote

hi,
in my program i want to spool a job..ie the jcl should be written to spool and it will execute from there when t spool is closed. how can i easily declare the jcl statements in working storage and use when writing to spool.if i can declare them like an array it will be easier. but how to implement.

some one please help me ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group