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

Can we pass value from COBOL to JCL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jamshirqureshi

New User


Joined: 13 Aug 2006
Posts: 20
Location: mumbai

PostPosted: Wed Dec 27, 2006 3:19 pm
Reply with quote

Hi Friends

Can We pass value from Cobol to JCL. If yes can anybody tell me How?

Jamz
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Dec 27, 2006 3:29 pm
Reply with quote

Hi !

Do you mean the ReturnCode ???

Move 8 to return-code. Then programm ends with rc=8.

Regards, UmeySan
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Dec 27, 2006 5:19 pm
Reply with quote

Hi There,

Please refer the below link

ibmmainframes.com/viewtopic.php?t=16020&start=15
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Dec 27, 2006 6:09 pm
Reply with quote

Hi !

I before mentioned the return-code field in cobol to passing Rc-Value to JCL to control the job-flow.

You also can pass a complete separate job back to the system (JES).
Perhaps, depending on a situation, your programm has to activate two different processes.

1.) you could achieve it by setting return-code an leaving programm.
back in JCL you could evaluate the rc by using JCL-IF-Statement for the next following two steps.

STEP010 EXEC PGM=HUGO,DYNAMNBR=20

// IF (RC EQ 0) THEN
//STEP020 EXEC PGM=INGE
//SYSPRINT DD SYSOUT=*
// ENDIF

// IF (RC EQ 4) THEN
//STEP020 EXEC PGM=PETRA
//SYSPRINT DD SYSOUT=*
// ENDIF

// IF (RC EQ 8) THEN
//STEP030 EXEC PGM=JUTTA
//SYSPRINT DD SYSOUT=*
// ENDIF



2.) You could sent a complete Job to JES and run it via internal Reader.
I do not prefer this. But for the sake of completeness i just tell you.

In comon, you write the job-control-cards to a seq-file and this is specified
in the JCL as input for the internal reader.
//FILE DD SYSOUT=(*,INTRDR)

Little example:

ID DIVISION.
PROGRAM-ID. HUGO.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FILE ASSIGN TO FILE
DATA DIVISION.
FILE SECTION.
FD FILE.
01 FILEREC PIC X(80).
WORKING-STORAGE SECTION.
...

PROCEDURE DIVISION.
OPEN OUTPUT FILE

MOVE '//IER1337 JOB NOTIFYIER1337' TO FILEREC
WRITE FILEREC

MOVE '//STEP1 EXEC PGM=IEFBR14' TO FILEREC.
WRITE FILEREC

...

CLOSE
GOBACK

But as I said, I do not prefer this for normal applikation programms.
I did it sometimes, but there had been requirements in system-programms for that.

Regards, UmeySan
Back to top
View user's profile Send private message
jamshirqureshi

New User


Joined: 13 Aug 2006
Posts: 20
Location: mumbai

PostPosted: Thu Dec 28, 2006 9:55 am
Reply with quote

Thanks
Jamz
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 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
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top