MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Query related to RETURN-CODE & FINISH

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Mon Aug 29, 2005 2:17 pm    Post subject: Query related to RETURN-CODE & FINISH Reply with quote

Hi All,

I came across this situation when I was testing a IDMS batch cobol program. In one of my programs I was moving 99 to RETURN-CODE if the input file was empty and subsequently halted the execution. When I tested my changes with a empty file, the job gave a return code of 0. Confused
Below is the piece of code:

Code:
IF WS-NO-OF-RECS-READ = ZERO
MOVE 99 TO RETURN-CODE
FINISH
CLOSE IN-FILE
STOP RUN.


I just took a wild guess Idea and interchanged the lines of FINISH and the earlier MOVE statement. When I compiled the program and re-ran the job, surprisingly it gave a RC=99 for the empty file Exclamation
Can I infer from this test that the FINISH is over laying the return code values Question

Thanks,
Ram
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Aug 29, 2005 11:27 pm    Post subject: Reply with quote

Can you please compile the program with LIST,NOOFFSET? Paste the generated Assembler statements for the above COBOL code here.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 30, 2005 3:33 am    Post subject: Reply with quote

Cogito,

Is Finish a IDMS variable ? I am aware of FINISH in PL/I but not in cobol.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Aug 30, 2005 4:13 am    Post subject: Reply with quote

I remember using FINISH in IDMS-COBOL programs when I was working on IDMS. But, now I checked the VS COBOL II manual and FINISH does come under reserverd words' list. FINISH

Note that, it comes under the heading of CODASYL. And, I think, CODASYL is related to IDMS. How? I do not know.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Aug 30, 2005 4:14 am    Post subject: Reply with quote

With the compile listing, I was hoping to see an SR or XR isntruction for R15 (for FINISH) that holds the return code. If this indeed the case, then Ram's theory might be correct.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 30, 2005 4:21 am    Post subject: Reply with quote

Quote:

Note that, it comes under the heading of CODASYL. And, I think, CODASYL is related to IDMS. How? I do not know.


CODASYL has got nothing to do with IDMS. CODASYL stands for Conference On Data Systems Languages, an organization founded in 1957 by the U.S. Department of Defense which was responsible for developing COBOL.

Source : google
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Aug 30, 2005 5:41 am    Post subject: Reply with quote

Cogito,Kolusu

Thank you for the prompt response and apologies for replying late to your queries. I have compiled the program with LIST and NOOFFSET options and am pasting the code and its instruction below.

Code:

4770              *    FINISH                                 
4771                    MOVE 66 TO DML-SEQUENCE             
4772                    CALL 'IDMS' USING SUBSCHEMA-CTRL     
4773                            IDBMSCOM (2);               
4774                    MOVE     98             TO RETURN-CODE 
4775                    CLOSE  O-FILEA                   
4776                                O-FILEB                     
4777                                O-FILEC                   
4778                                O-FILED                   
4779                                O-FILEE                     
4780                                STOP RUN.         


The assembler listing is as below :

Code:

4771    MOVE       08D7EE  4772    CALL       08D7F8
                                                     
4774    MOVE       08D838   4775    CLOSE      08D83E

4780    STOP       08DA14 


Kolusu FINISH is a IDMS command issued at the end of a program to release all database resources. Let me know if you need further info.
Thanks once again. Smile

Ram
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Aug 30, 2005 5:55 am    Post subject: Reply with quote

Ram,
Have you commented out FINISH?

If yes, uncomment it, then compile with LIST,NOOFFSET. I wanted to see the assembler listing for FINISH.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 30, 2005 6:33 am    Post subject: Reply with quote

Quote:

Kolusu FINISH is a IDMS command issued at the end of a program to release all database resources. Let me know if you need further info.


Ram,

If FINISH command works internally as a subroutine, then return-code is initialized. Check this link which explains the working of the return-code.

http://www.mvsforums.com/helpboards/viewtopic.php?t=4709

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Aug 30, 2005 9:01 am    Post subject: Reply with quote

Cogito,

I haven't commented out the FINISH statement. When compiling IDMS-Cobol programs, the DML Compiler will first comment all the IDMS statements and replace them with equivalent Cobol recognizable statements. The so modified source program is then given to the cobol compiler for compilation.

Kolusu,

Thanks for the link. Its really informative.

Ram
Back to top
View user's profile Send private message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Aug 30, 2005 9:21 am    Post subject: Reply with quote

Kolusu,

After going through the link posted by you,I think the FINISH statement is over laying the values in RETURN-CODE. As I said earlier that FINISH will be commented and an equivalent Cobol recognizable statement is inserted. I guess here the RETURN-CODE will be replaced with that of FINISH. Correct me if my assumption is wrong Wink

Thanks,
Ram
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 30, 2005 10:20 am    Post subject: Reply with quote

Quote:
As I said earlier that FINISH will be commented and an equivalent Cobol recognizable statement is inserted. I guess here the RETURN-CODE will be replaced with that of FINISH. Correct me if my assumption is wrong


Ram,

Check your compile listing to see if the DML Compiler indeed have replace the IDMS commands with a "CALL" statement. If it did then it explains the reason for the re-setting of the return-code variable.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Aug 30, 2005 12:32 pm    Post subject: Reply with quote

Kolusu,

The DML Compiler replaces all IDMS statements with a CALL statement and this explains why the RETURN-CODE was getting over layed. Fortunately I trapped this in the testing stage and was able to avoid major goof ups in the production.
Shocked

Kolusu & Cogito a big thank you to you both Very Happy

Ram
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Aug 31, 2005 4:48 am    Post subject: Reply with quote

You are welcome, Ram !
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group