View previous topic :: View next topic
|
Author |
Message |
krishna_Murty Warnings : 2 New User
Joined: 17 Sep 2006 Posts: 24
|
|
|
|
Can some one give a sample and simple code to run a job from a Cobol Program.
Actually if we write a output file and write the output lines which makes
up a JCL, once the output lines are completed are there any instructions given like submit from cobol itself to run this output file. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Since SUBMIT is also a TSO command, you can issue it from within COBOL, just like any other TSO command. See example here.
Another option is to direct your output lines to INTRDR.
O. |
|
Back to top |
|
|
krishna_Murty Warnings : 2 New User
Joined: 17 Sep 2006 Posts: 24
|
|
|
|
Thanks but the example site here is not active. Is there any alternative. viz give other links or copy and paste the code here. |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
Your question : How do I submit a JOB from my COBOL program ?
If I have understood your question I have a suggestion.
1. Do all processing you want to in your COBOL program.
2. Define the JOB card, EXEC, DD statements as working storage varialbles, like the below one :-
Code: |
01 BATCH-JCL-AREA.
...CARD 1
05 JOB-CARD.
10 FILLER PIC X(04) VALUE "//DL".
10 WS-XXX PIC X(02).
10 WS-JOB-NAME-2 PIC X(05) VALUE "EXAMP".
10 FILLER PIC X(10) VALUE "JOB CLASS=".
10 WS-XXX PIC X(01).
10 FILLER PIC X(10) VALUE ",MSGCLASS=".
10 WS-MSGCLASS-1 PIC X(01).
10 FILLER PIC X(47) VALUE SPACES.
...CARD 2
05 JCLLIB-CARD.
10 FILLER PIC X(20) VALUE "// JCLLIB ORDER=(ZX.".
10 WS-ENV-1 PIC X(07) VALUE "PROD.DL".
10 WS-DEPOT-2 PIC X(02).
10 FILLER PIC X(12) VALUE ".PROCLIB,ZX.".
10 WS-ENV-2 PIC X(04) VALUE "PROD". |
define the job cards just like the above. You coding this depends on what your JCL should have.
Code: |
EXEC CICS WRITEQ TD
QUEUE("DSUB")
FROM(JCL-CARD)
END-EXEC |
DSUB is my INTRDR. You might need to ask your system administrator about yours.
Write all the contents into the INTRDR (Internal reader).
You would require a TDQ to which you write your job statements and the TDQ name is the name of your INTRDR.
Once you start writing it into the INTRDR, the job would get submitted.
Hope this info helps... |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
I think he was asking about COBOL under TSO, not CICS...
O. |
|
Back to top |
|
|
Kevin
Active User
Joined: 25 Aug 2005 Posts: 234
|
|
|
|
Quote: |
How to run a JCL from COBOL
|
You run a JOB. Jobs are written in JCL. This is like saying you want to "execute a COBOL". Doesn't really make sense, does it? |
|
Back to top |
|
|
krishna_Murty Warnings : 2 New User
Joined: 17 Sep 2006 Posts: 24
|
|
|
|
Thank you so much, after posting the question i became little busy and could not see the forum again. i will review the code and get back.
Once again thanks for taking so much importance for my query and replying to it. |
|
Back to top |
|
|
krishna_Murty Warnings : 2 New User
Joined: 17 Sep 2006 Posts: 24
|
|
|
|
ofer71
I wrote a COBOL program, Just for ur understanding the main statements in COBL PRG ARE
FILE-CONTROL
SELECT JCL-OUT ASSIGN TO UT-S-JCLDD.
DATA DIVISION.
FD JCL-OUT
RECORD CONTAINS 80 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS JCL-RECOUT.
01 JCL-RECOUT PIC X(80).
00000-MAINLINE.
OPEN INPUT JCL-IN
OPEN OUTPUT JCL-OUT
PERFORM 1000-READ-MOVE UNTIL EOF
CLOSE JCL-IN
CLOSE JCL-OUT
GOBACK.
1000-READ-MOVE.
IF NOT EOF
READ JCL-IN INTO WS-RECORD
AT END MOVE 'Y' TO WS-EOF
END-READ
MOVE WS-RECORD TO JCL-RECOUT
END-IF
This above cobol program reads JCL input file and move the records to output file, (Note I did not write the records to output only moved)
Now from the JCL point of view to run the above cobol , i wrote
//JCLDD DD SYSOUT=(*,INTRDR)
The job thus the Program is running fine but not executing the JCLDD file, ie. the output JCL file is not firing.
Can u please guide me, where i went wrong.
Also this is not from CICS point of view, this is batch programing i am looking for.
Thanks |
|
Back to top |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
Hi,
You coded completly right except you must write the record instead of just "MOVE WS-RECORD TO JCL-RECOUT"
so change the code to:
"write JCL-RECOUT from WS-RECORD."
krishna_Murty wrote: |
ofer71
I wrote a COBOL program, Just for ur understanding the main statements in COBL PRG ARE
FILE-CONTROL
SELECT JCL-OUT ASSIGN TO UT-S-JCLDD.
DATA DIVISION.
FD JCL-OUT
RECORD CONTAINS 80 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS JCL-RECOUT.
01 JCL-RECOUT PIC X(80).
00000-MAINLINE.
OPEN INPUT JCL-IN
OPEN OUTPUT JCL-OUT
PERFORM 1000-READ-MOVE UNTIL EOF
CLOSE JCL-IN
CLOSE JCL-OUT
GOBACK.
1000-READ-MOVE.
IF NOT EOF
READ JCL-IN INTO WS-RECORD
AT END MOVE 'Y' TO WS-EOF
END-READ
MOVE WS-RECORD TO JCL-RECOUT
END-IF
This above cobol program reads JCL input file and move the records to output file, (Note I did not write the records to output only moved)
Now from the JCL point of view to run the above cobol , i wrote
//JCLDD DD SYSOUT=(*,INTRDR)
The job thus the Program is running fine but not executing the JCLDD file, ie. the output JCL file is not firing.
Can u please guide me, where i went wrong.
Also this is not from CICS point of view, this is batch programing i am looking for.
Thanks |
|
|
Back to top |
|
|
kris.2020
New User
Joined: 09 May 2006 Posts: 2
|
|
|
|
Thanks for info
|
|
Back to top |
|
|
krishna_Murty Warnings : 2 New User
Joined: 17 Sep 2006 Posts: 24
|
|
|
|
Thanks to all
I got the job running fine
Regards
Krishna |
|
Back to top |
|
|
jijesh
New User
Joined: 09 May 2006 Posts: 4
|
|
|
|
Hi all
I am very news to Mainframes.
i was just not able to figure out the advantage of submitting a JCl through a cobol??????
if we need to run multiple programs, we can use a Proc. why then do we need one program like this?????
also can we submit the job for the same program???? or is it that this program will be run normally and all the others jobs will be triggered subsequently by this program.
please help me in having a better clarity about the entire concept.
thanks |
|
Back to top |
|
|
supreethi.srid
New User
Joined: 15 Oct 2009 Posts: 5
|
|
|
|
I am trying to execute a TSO command from IMS online by invoking transaction from the terminal. Getting RC of 16 while executing IKJTSOEV. Ignoring that assuming that the environment is already set, I continue to execute IKJEFTSR, I am getting the following :
RETURN CODE - 000000012
REASON CODE - 00000000J
ABEND CODE - 00000000J
For the above, I am trying to execute a sample TSO command to allocate a new dataset. Passed this flag combination - X'00010001'. (My original intent is to execute a set of ACF sub-commands, say, to reset expired password by resetting invalid pw count).
Please provide help on setting up appropriate flags for a sample allocate function. Does the command work at all for executing the TSO ACF sub-commands? - a question on feasibility now. If, so what flags for this one? |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Running the TSO SUBMIT command from a Cobol program is more complex than it has to be.
In z/OS, the system provides a capability called an "internal reader." An internal reader is a pseudo data set specified in JCL as
//ddname DD SYSOUT=(x,INTRDR)
The x in SYSOUT=(x,INTRDR) becomes the output message class for the submitted job unless the job's // JOB statement specifies MSGCLASS=y.
With the internal reader specified in the JCL used to run a Cobol program, all the Cobol program has to do is open the data set assigned to DD name ddname for output and write the JCL for the job the Cobol program wants to run to the data set.
This capability has been in the system since the first release of MVS. Use it! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
supreethi.srid, you replied to a topic TEN AND A HALF YEARS OLD! And your question really has nothing to do with the original topic. You need to find and read the forum rules before you post anything else.
Quote: |
Ignoring that assuming that the environment is already set, I continue to execute IKJEFTSR
|
This is stupid. You ignore return codes ONLY if you don't expect anything else you're doing to work. You should figure out what the return code means, and why you got it, and how to fix it BEFORE attempting to do anything else. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please start a completely new question, and be exactly clear about what you are trying to achieve, rather than how you are trying to achieve it.
"I want to be able to reset an 'ACF-password' from an IMS transaction". Is that it? |
|
Back to top |
|
|
|