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 

Cobol write problem..

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


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Mon May 19, 2003 10:04 am    Post subject: Cobol write problem.. Reply with quote

Hi,

I have two programs , program1 & program2.

Program1 calls program2 . I have one output file , which is common to both the programs (I mean new records would be added from the both the programs). I have defined FILE description in both the programs, and I opened that file in program1.


My problem is when I was trying to write new record into output file from program2 , It is getting abended. Could someone tell me why it is happening?

Please let me know if I am not clear.

Thanks
Anand
Back to top
View user's profile Send private message
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Mon May 19, 2003 11:01 am    Post subject: Reply with quote

What is this abend? That might be a good start.
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Mon May 19, 2003 11:14 am    Post subject: Reply with quote

Glenn,

Abend is S0C4 reason code 4

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


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Mon May 19, 2003 11:22 am    Post subject: Reply with quote

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea1h741/2.176?SHELF=&DT=20001023091127

Quote:

0C4
One of the following exceptions occurred:

4
Protection exception. The key of the storage area that the running program tries to access is different from that of the running program. The key of the running program can be obtained from the PSW key field. The key of the storage can be obtained using the IPCS LIST subcommand. The programmer should determine whether the program is running with the correct key or whether the storage address is set up correctly.

The protection exception might have occurred when the program referenced a page that is protected with the PGSER PROTECT service, or is defined as shared by the IARVSERV service with a view of read-only.


It's likely you're doing something with your output file in each of the programs that is clashing with the other - like perhaps the duplicate FD definitions or other things.
You might start looking at your code to determine WHERE this abend is occurring in your coding.
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Mon May 19, 2003 12:42 pm    Post subject: Reply with quote

Glenn,

I have only one output file in both calling & called program. Here is the file description that I had coded in both the programs.

FD OUPUT-FILE
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD
DATA RECORD IS OUTPUT-REC.
01 OUTPUT-REC PIC X(60).


The abend had occured while writing into the output file.

WRITE OUTPUT-REC.

Thanks
Anand
Back to top
View user's profile Send private message
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Mon May 19, 2003 1:06 pm    Post subject: Reply with quote

OK so let me see if I have the situation correct? First program issues OUTPUT open and will write records. First program calls second program which will ALSO write records. Upon return from second program, first program may write more records or close the file? Is this the general scenario? And which program abends with the WRITE?
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Mon May 19, 2003 1:25 pm    Post subject: Reply with quote

Glenn,

While writing record in the second program(Called), the JOB getting abended. Moreover, it is not returning to the first program . Becuase Job got abended in second program itself with s0c4, while writing the record.


thanks
Anand
Back to top
View user's profile Send private message
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Mon May 19, 2003 1:27 pm    Post subject: Reply with quote

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG00/4.2.6.1?DT=20011203125201#HDRDUP1875

There's the answer to your question. It's as I suspected (the FD's are clashing if you don't use a special keyword). The manual has examples too.
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Mon May 19, 2003 2:25 pm    Post subject: Reply with quote

Glenn,


It did work "External".. Thanks a lot..
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