View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I have a code like this,
WORKING-STORAGE SECTION.
01 A PIC S9(5) COMP-3 VALUE 0.
01 B PIC S9(5) COMP-3 VALUE 1.
PROCEDURE DIVISION.
IF A < B
MOVE 16 TO RETURN-CODE
DISPLAY 'THE RETURN-CODE IS:' RETURN-CODE
ELSE
MOVE 0 TO RETURN-CODE
DISPLAY 'THE RETURN-CODE IS:' RETURN-CODE
END-IF.
GOBACK.
When I execute it, I am unable to get the return code which was set in my cobol program.. Should I do any changes in my jcl for receiving it.
Please help.... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
When I execute it, I am unable to get the return code which was set in my cobol program.. Should I do any changes in my jcl for receiving it. |
what do You mean by get ... receiving ???
a return code can be <tested> in the subsequent steps using the appropriate COND and/or IF
You can see the return code by looking at the jes log for the jcl |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
What is the RETURN-CODE from your DISPLAY 'THE RETURN-CODE IS:'?
Your JCL should have something like the following too:
//SYSOUD DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*,OUTLIM=10000
//SYSUDUMP DD SYSOUT=* |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
No. I am setting a return code 1 in my program based on a scenario. I need to receive that return code when I submit my jcl from my cobol program. But my jcl always shows RC of zero.
Plz help me. |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
RC of zero...
So, "A" was equal or greater than "B" according to your code?
Maybe I'm missing something here. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Quote: |
when I submit my jcl from my cobol program |
You'd best explain this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
why don' t You simply run
Code: |
****** ***************************** Top of Data ******************************
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID RETCODE.
000003 AUTHOR. <SOME AUTHOR>
000004 ENVIRONMENT DIVISION.
000005 DATA DIVISION.
000006 WORKING-STORAGE SECTION.
000007 PROCEDURE DIVISION.
000008 MOVE 4 to RETURN-CODE .
000009 GOBACK.
****** **************************** Bottom of Data **************************** |
and see the
Code: |
IEF142I RETCODE G GO - STEP WAS EXECUTED - COND CODE 0004 |
so You will see that COBOL/JCL and friends behave as expected,
and realize that there might be something wrong somewhere in Your code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
telling us
Quote: |
I have a code like this, |
it is not enough to provide an answer .
IT is pretty deterministic and it does not appreciate like descriptions
I was curious and as expected from a nice compiler
Code: |
****** ***************************** Top of Data ******************************
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID RETCOD2.
000003 AUTHOR. <SOME AUTHOR>
000004 ENVIRONMENT DIVISION.
000005 DATA DIVISION.
000006 WORKING-STORAGE SECTION.
000007 01 A PIC S9(5) COMP-3 VALUE 0.
000008 01 B PIC S9(5) COMP-3 VALUE 1.
000009 PROCEDURE DIVISION.
000010 IF A < B
000011 DISPLAY ' A IS LESS THAN B'
000012 MOVE 4 TO RETURN-CODE
000013 ELSE
000014 DISPLAY ' A IS GRTR THAN B'
000015 MOVE 8 TO RETURN-CODE
000016 END-IF.
000017 GOBACK.
****** **************************** Bottom of Data **************************** |
ended with ...
Code: |
SDSF OUTPUT DISPLAY ENRICO1 JOB01282 DSID 106 LINE 0 COLUMNS 02- 81
COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
A IS LESS THAN B
******************************** BOTTOM OF DATA ******************************** |
and ( the obvious )
Code: |
IEF142I ENRICO1 G GO - STEP WAS EXECUTED - COND CODE 0004 |
if You want good answers learn to post good questions
|
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Good day to all!
Abdulrafi, is this a sub-program which you are calling from a main program? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
No. I am setting a return code 1 in my program based on a scenario. I need to receive that return code when I submit my jcl from my cobol program. But my jcl always shows RC of zero. |
Let's see if this is what you are trying to do:
1. You submit JCL to execute job A that executes program A
2. Program A has the code you posted to set RETURN-CODE based on some variable values
3. Critical question: are you expecting the rest of job A that executes program A to use the return code set by program A, or are you submitting a new job B via your COBOL program A?
For the critical question, if you are submtiting job B via your program A and expecting job B to be able to access the return code set in program A, then you are going to be disappointed because job B is completely and totally distinct from job A and the return code cannot be passed across. You can modify job B JCL to include a SET statement (BEFORE you submit the JCL), but that will not be a return code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
that' s what I asked
Quote: |
what do You mean by get ... receiving ??? |
but the TS never cared to aknowledge |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Thanks for your help... I got it done :-) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
Thanks for your help... I got it done |
thanks &deity
but You still did not care to explain anything |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
abdulrafi, you did not respond to requests for explanations and now all of a sudden you've resolved the issue -- without ever clearly identifying the issue nor its resolution. Do you really think your behavior in this thread is conducive to you getting more help the next time you post a question? |
|
Back to top |
|
|
|