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

Pass values from a cobol program to its calling jcl


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 3156
Location: Tucson AZ

PostPosted: Fri Dec 01, 2006 3:12 pm
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
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
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
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 01, 2006 9:34 pm
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
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

Moderator Emeritus


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

PostPosted: Sun Dec 03, 2006 1:29 am
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
Reply with quote

Hi..,

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

Moderator Emeritus


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

PostPosted: Tue Dec 05, 2006 8:58 pm
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: 2481
Location: @my desk

PostPosted: Wed Dec 06, 2006 11:50 am
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
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
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
Reply with quote

Thanks Craq Giegerich..
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Sep 02, 2009 1:12 am
Reply with quote

GLOBAL declarations are used with NESTED programs.

EXTERNAL declarations are used with CALLED progams within the run unit.

Bill
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 02, 2009 6:22 am
Reply with quote

Hi,

a slight change to Dick's suggestion, CATLG the file in YOURSTEP and if the return code is 100, run an IEFBR14 step to delete the file.


Gerry
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top