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
 

 

Pass values from a cobol program to its calling jcl
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 01, 2006 2:03 pm    Post subject: Pass values from a cobol program to its calling jcl
Reply with quote

hi,
can anyone help me to pass values from a cobol program to its calling jcl?

i just want to stop the creation of a file, that was declared in the DD statement as (new,catlg,delete) if a certain conditin occurs in the cobol program.

thanks and regards,
balaji
Back to top
View user's profile Send private message

Farooq

New User


Joined: 24 Nov 2006
Posts: 15
Location: Chennai

PostPosted: Fri Dec 01, 2006 2:54 pm    Post subject:
Reply with quote

Hi Balaji,

You can Use the PARM perameter in JCL, to Pass the Values

Thanks!
Farooq
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Dec 01, 2006 3:12 pm    Post subject:
Reply with quote

Farooq, wrong direction....

Balaji, correct me if I'm wrong, but if you don't open it it won't be created.....
Back to top
View user's profile Send private message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 01, 2006 3:15 pm    Post subject:
Reply with quote

i just wanted to pass the values from cobol to jcl..
how could parm help in it???
Back to top
View user's profile Send private message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 01, 2006 3:17 pm    Post subject:
Reply with quote

i tried it but it seems that the file is created even if the execution doesn't eneter the open para...
is there any changes to be made in the jcl???
Back to top
View user's profile Send private message
Farooq

New User


Joined: 24 Nov 2006
Posts: 15
Location: Chennai

PostPosted: Fri Dec 01, 2006 3:17 pm    Post subject:
Reply with quote

Hi William Thompson,

Sorry, i miss understood the question!

Thanks!
Farooq
Back to top
View user's profile Send private message
Farooq

New User


Joined: 24 Nov 2006
Posts: 15
Location: Chennai

PostPosted: Fri Dec 01, 2006 3:19 pm    Post subject:
Reply with quote

Hi William Thompson,

Sorry, i miss understood the question!

Thanks!
Farooq
Back to top
View user's profile Send private message
Farooq

New User


Joined: 24 Nov 2006
Posts: 15
Location: Chennai

PostPosted: Fri Dec 01, 2006 3:30 pm    Post subject:
Reply with quote

HI Balaji,

You can set the Return code to 8 in the cobol program, then handel this in JCL


Correct me if i am wrong!

Thanks
Farooq
Back to top
View user's profile Send private message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 01, 2006 4:17 pm    Post subject:
Reply with quote

hi farooq,
how can v set the return code using cobol?
Back to top
View user's profile Send private message
narasridhar

New User


Joined: 12 Oct 2006
Posts: 32
Location: India

PostPosted: Fri Dec 01, 2006 4:51 pm    Post subject: Re: communicating from cobol to jcl
Reply with quote

Hi Balaji,

U can send the return code from the cobol by coding the statement like

MOVE 8 to RETURN-CODE.

Thanks,
Sridhar
Back to top
View user's profile Send private message
nbalajibe
Warnings : 1

New User


Joined: 28 Nov 2006
Posts: 75
Location: India

PostPosted: Fri Dec 01, 2006 7:46 pm    Post subject: Re: communicating from cobol to jcl
Reply with quote

hi,
thanks for ur kind reply.
Is the RETURN-CODE field just simply defined in the working storage section or any special declarations required.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Dec 01, 2006 9:34 pm    Post subject:
Reply with quote

Hello,

An easy way to accomplish this is to create a temporary file (i.e. DSN=&&tmp,DISP=(new,pass,delete)) in the program and then set the return code depending on whether the file should actually be created. Follow the COBOL program with a step that executes IEBGENER conditionally - depending on the return code set in the COBOL step. The CATLG should only be coded in the IEBGENER step.

Hope this helps. . . .

d.sch.
Back to top
View user's profile Send private message
muthukannan

New User


Joined: 03 Aug 2006
Posts: 42
Location: Chennai

PostPosted: Sat Dec 02, 2006 5:39 pm    Post subject: Can you please explain more on this?
Reply with quote

Hi dick scherrer,

I couldn't reach you. Can you please explain more on your answer, Like How can we create a temp file.

Thank you,
MK
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Dec 03, 2006 1:29 am    Post subject: Re: Pass values from a cobol program to its calling jcl
Reply with quote

Hi MK,

Creating and using this temporary file is primarily a JCL function. The && in the dataset name tells the operating system that this file will only be used within this job (as opposed to being saved for future use).

The program will need to be changed to pass a condition code that will "tell" the next step whether to execute or not. Let's use 100 for the condition code that tells the IEBGENER step to execute:
(MOVE 100 TO RETURN-CODE)

For the IEBGENER step , operation is controlled by the condition code - if the condition code was NOT set to 100, the step will be bypassed.

Here is a bit of sample JCL to show the 2 steps:

//THEJOB JOB . . . . .
.
.
.
//YOURSTEP EXEC PGM=YOURPGM
//*
//THEFILE DD DSN=&&TMP,DISP=(NEW,PASS,DELETE),UNIT=SYSDA,
// other parameters for the dataset
//DD2 DD . . . . Whatever YOURPGM requires. . .
//DD3 DD . . . .
//SYSOUT DD SYSOUT=*
//*
//GENER EXEC PGM=IEBGENER,COND=(100,NE,YOURSTEP)
//SYSUT1 DD DSN=&&TMP,DISP=(OLD,DELETE,DELETE)
//SYSUT2 DD Your file definition. . . . DISP=(NEW,CATLG,DELETE), etc.
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
.
.
.

While it does look confusing, the COND parameter above tells the operating system that if YOURSTEP did NOT issue an RC=100, the GENER step is NOT to run.

When the GENER step IS executed, the CATLG will be executed and the file be retained.

Hope this helps. . . .

d.sch.
Back to top
View user's profile Send private message
vijay_bn79

New User


Joined: 20 Nov 2006
Posts: 48
Location: Hyderabad

PostPosted: Tue Dec 05, 2006 10:44 am    Post subject: Re: Pass values from a cobol program to its calling jcl
Reply with quote

Hi..,

No need to declare Return code in code
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Dec 05, 2006 8:58 pm    Post subject:
Reply with quote

Hello,

Yes, there is a need to "declare Return code in code". If it is NOT specified in the code, it will NOT be available to subsequent JCL steps.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2171
Location: @my desk

PostPosted: Wed Dec 06, 2006 11:50 am    Post subject:
Reply with quote

Hi

But as I believe RETURN-CODE is a special register which has an implicit definition

Code:
01  RETURN-CODE GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO.



After the execution of the program the contents of the register will be returned to the operating system as a user return code.The RETURN-CODE special register can be set using the following statements.

COMPUTE RETURN-CODE = 8.

MOVE 8 to RETURN-CODE.

Please let me know why it needs an explicit definiton even though the contents are available to the operating system.

Thanks
Arun
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Wed Sep 02, 2009 12:22 am    Post subject: Reply to: Pass values from a cobol program to its calling jc
Reply with quote

Hello Arun,
i am facing some error while using your following suggestion.
"01 RETURN-CODE GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO."

error is below:

IGYDS1089-S "RETURN-CODE" was invalid. Scanning was resumed at the next area "A" item, level-number, or the start of the next clause

A data-name was not specified for an entry containing a "GLOBAL" clause. The "GLOBAL" clause was discarded.


Please suggest where i am missing....
Regards,
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Sep 02, 2009 12:41 am    Post subject:
Reply with quote

RETURN-CODE is predefine in COBOL, it is a reserved word that you can move a value to but you can not define it. RTFM
Back to top
View user's profile Send private message
GauravKudesiya
Warnings : 1

New User


Joined: 11 Oct 2008
Posts: 74
Location: Chicago, IL

PostPosted: Wed Sep 02, 2009 12:52 am    Post subject:
Reply with quote

Thanks Craq Giegerich..
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm


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