View previous topic :: View next topic |
Author |
Message |
Ram Beginner

Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Mon Aug 29, 2005 2:17 pm Post subject: Query related to RETURN-CODE & FINISH |
|
|
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.
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 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
Can I infer from this test that the FINISH is over laying the return code values
Thanks,
Ram |
|
Back to top |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Mon Aug 29, 2005 11:27 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Aug 30, 2005 3:33 am Post subject: |
|
|
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 |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Aug 30, 2005 4:13 am Post subject: |
|
|
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 |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Aug 30, 2005 4:14 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Aug 30, 2005 4:21 am Post subject: |
|
|
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 |
|
 |
Ram Beginner

Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Tue Aug 30, 2005 5:41 am Post subject: |
|
|
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.
Ram |
|
Back to top |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Aug 30, 2005 5:55 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Aug 30, 2005 6:33 am Post subject: |
|
|
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 |
|
 |
Ram Beginner

Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Tue Aug 30, 2005 9:01 am Post subject: |
|
|
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 |
|
 |
Ram Beginner

Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Tue Aug 30, 2005 9:21 am Post subject: |
|
|
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
Thanks,
Ram |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Aug 30, 2005 10:20 am Post subject: |
|
|
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 |
|
 |
Ram Beginner

Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Tue Aug 30, 2005 12:32 pm Post subject: |
|
|
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.
Kolusu & Cogito a big thank you to you both
Ram |
|
Back to top |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Wed Aug 31, 2005 4:48 am Post subject: |
|
|
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 |
|
 |
|
|