View previous topic :: View next topic
|
Author |
Message |
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
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 |
|
|
Farooq
New User
Joined: 24 Nov 2006 Posts: 15 Location: Chennai
|
|
|
|
Hi Balaji,
You can Use the PARM perameter in JCL, to Pass the Values
Thanks!
Farooq |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
i just wanted to pass the values from cobol to jcl..
how could parm help in it??? |
|
Back to top |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
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 |
|
|
Farooq
New User
Joined: 24 Nov 2006 Posts: 15 Location: Chennai
|
|
|
|
Hi William Thompson,
Sorry, i miss understood the question!
Thanks!
Farooq |
|
Back to top |
|
|
Farooq
New User
Joined: 24 Nov 2006 Posts: 15 Location: Chennai
|
|
|
|
Hi William Thompson,
Sorry, i miss understood the question!
Thanks!
Farooq |
|
Back to top |
|
|
Farooq
New User
Joined: 24 Nov 2006 Posts: 15 Location: Chennai
|
|
|
|
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 |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
hi farooq,
how can v set the return code using cobol? |
|
Back to top |
|
|
narasridhar
New User
Joined: 12 Oct 2006 Posts: 32 Location: India
|
|
|
|
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 |
|
|
nbalajibe Warnings : 1 New User
Joined: 28 Nov 2006 Posts: 75 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
muthukannan
New User
Joined: 03 Aug 2006 Posts: 42 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
vijay_bn79
New User
Joined: 20 Nov 2006 Posts: 48 Location: Hyderabad
|
|
|
|
Hi..,
No need to declare Return code in code |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
GauravKudesiya Warnings : 1 New User
Joined: 11 Oct 2008 Posts: 74 Location: Chicago, IL
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
GauravKudesiya Warnings : 1 New User
Joined: 11 Oct 2008 Posts: 74 Location: Chicago, IL
|
|
|
|
Thanks Craq Giegerich.. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
GLOBAL declarations are used with NESTED programs.
EXTERNAL declarations are used with CALLED progams within the run unit.
Bill |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
|