IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Getting S0C4, while initializing record


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Wed Apr 01, 2009 12:19 pm
Reply with quote

Hi,

I have coded one program and I am getting S0C4 in program while initializing output file record.

Design of program is such that after opening the files I am initializing output file record with INITIALIZE verb and then all other processing is started.

Can you please help me for that?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Apr 01, 2009 12:35 pm
Reply with quote

sachin.mandaliya wrote:
I have coded one program and I am getting S0C4 in program while initializing output file record.
How do you conclude this? S0C4 is Protection Exception . . . icon_confused.gif
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Wed Apr 01, 2009 12:36 pm
Reply with quote

can you please provide more info regarding the abend. below are the resaons for S0C4

Code:

    DESCRIPTION:  S0C4 - AN INVALID MACHINE ADDRESS WAS CALCULATED             
                  BY THE PROGRAM.                                               
                                                                               
PROBABLE CAUSES:   1. A SUBSCRIPT OR INDEX CONTAINED AN INVALID VALUE.         
                   2. A JCL DD STATEMENT WAS EITHER INVALID OR MISSING.         
                   3. THE BLOCKSIZE AND RECORD SIZE WERE SPECIFIED AS EQUAL     
                      FOR VARIABLE LENGTH RECORDS.                             
                   4. AN ATTEMPT WAS MADE TO READ/WRITE AN UNOPENED DATA SET.   
                   5. AN ATTEMPT WAS MADE TO READ AFTER END-OF-FILE.           
                   6. A STOP RUN OCCURRED:                                     
                      A. BEFORE ALL OPENED DATA SETS WERE CLOSED.               
                      B. IN THE INPUT OR OUTPUT PROCEDURE OF A SORT.           
                   7. AN ATTEMPT WAS MADE TO REFERENCE AN INPUT/OUTPUT AREA     
                      BUT NO OPEN OR READ HAD OCCURRED FOR THE DATA SET.       
                   8. INVALID PARAMETERS WERE PASSED THROUGH THE LINKAGE SECTION
                   9. THE FILE-CONTROL SELECT CLAUSE WAS MISSING               
                      FOR THE DATA SET THAT WAS BEING PROCESSED.
           
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Wed Apr 01, 2009 12:41 pm
Reply with quote

are you usning an array or table in your program. Even i had the same S0C4 problem recently.
Back to top
View user's profile Send private message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Wed Apr 01, 2009 1:44 pm
Reply with quote

I have executed program through Xpeditor and found that while initializing it got S0C4
Back to top
View user's profile Send private message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Wed Apr 01, 2009 1:47 pm
Reply with quote

Also there is no array or table.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 01, 2009 3:44 pm
Reply with quote

Is the file open before the initialize?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 01, 2009 5:13 pm
Reply with quote

What does the 01 for the FD look like?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Apr 01, 2009 8:13 pm
Reply with quote

Craq Giegerich wrote:
Is the file open before the initialize?

Do you initialize the area specified under the FD (in FILE SECTION) or an area in WORKING-STORAGE ??
Back to top
View user's profile Send private message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Fri Apr 03, 2009 3:59 pm
Reply with quote

FD entry just contains simple variables. and I have used INITIALISE verb for initializing.
Back to top
View user's profile Send private message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Fri Apr 03, 2009 4:05 pm
Reply with quote

Hi Everyone,

My problem is now resolved, but I don't know how is it resolved.

What I have done is I have shifted my initialization of output record after first read of an input file.

All other things are same, but now it is working fine.

I analysed code again but not able to get exact resolution. If anybody knows possible reason behind it then please do let me know.

Thank you all for you help.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Apr 03, 2009 4:09 pm
Reply with quote

Craq Giegerich wrote:
Is the file open before the initialize?
Are you sure about this?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 03, 2009 4:54 pm
Reply with quote

Quote:
If anybody knows possible reason behind it then please do let me know.
Since you've been asked a number of questions about the code and how you're doing the INITIALIZE, none of which you have answered, I suspect you're not going to get a lot of responses.
Back to top
View user's profile Send private message
sachin.mandaliya

New User


Joined: 17 Jan 2007
Posts: 24
Location: India

PostPosted: Fri Apr 03, 2009 5:05 pm
Reply with quote

Quote:
Are you sure about this?

Yes very sure....


Quote:
Since you've been asked a number of questions about the code and how you're doing the INITIALIZE, none of which you have answered, I suspect you're not going to get a lot of responses.

Robert, I think I have given all anwer to questions.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 03, 2009 5:52 pm
Reply with quote

Actually, you haven't posted any code from your program -- you've posted your answers, which are your interpretations of the code. Your interpretations may or may not be correct, which is why we ask to see the actual code, not your answers to the questions. So from the standpoint of answering the asked questions, you haven't provided a single thing for us to analyze. Technically you answered the questions but you did not answer them in a way that allows us to help you. Obviously, if your interpretations were correct you would not have had to ask for help here. When I asked what the 01 for the FD looked like, I wanted to see the actual 01 in BBCode format, not your answer of
Quote:
FD entry just contains simple variables. and I have used INITIALISE verb for initializing.
which does not tell us anything. For example, just what do you call a "simple variable"? PIC X? PIC 9? Edited alphanumeric? Edited numeric? National characters? Arrays without ODO? We have no way of telling without looking at the actual program code which you never provided. I repeat: so you never gave us the data we asked for.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Jan 15, 2015 1:12 am
Reply with quote

Although It is an old post, I would like to share what happened with me. I was also getting a S0C4 at INITIALIZE statement and that is when I got to this thread.

The problem I saw, was with the output file size. When I increased the file size then the problem was resolved. It seems pretty obvious when you know the solution. icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 15, 2015 5:21 am
Reply with quote

I don't think so, but if you're happy, what can we do?

A S0C4 you get by attempting to access storage you are not allowed to access. How would making the amount of storage you are attempting to access larger make that, in itself, go away?

As always, without seeing the relevant code, there's not much to go on...
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Jan 15, 2015 9:34 am
Reply with quote

I believe it was because the program was writing about 3 million records in the output file but the file size was small to contain such large number of records. Hence by increasing the size we are able to fit those records in the file.
Does that sound right?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jan 15, 2015 5:22 pm
Reply with quote

RahulG31: you apparently do not understand the difference between disk space and CPU memory. While the situation you described can cause ABENDs, it will not cause a S0C4 ABEND. The S0C4 occurs when a program attempts to access (read or write) memory in the CPU for which the program does not have access (because the memory location doesn't exist or is in use by another program or ... ). Not having space to write 3 million records would be a problem with disk space, not CPU memory.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 15, 2015 6:51 pm
Reply with quote

The second word of the PSW (in the dump) will give you the address of the NSI (next sequential instruction). Note that the high-order bit of this address will most likely be 'on'. So, subtract X'80000000' from this address for the real address.

HTH....
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Jan 15, 2015 8:00 pm
Reply with quote

I have to agree with you. But (for me) the fact remains that by increasing the size of the file I got out of trouble. There were No changes to the program. I'll analyze more the next time I face this problem. Let me be happy till that time.. ;)

Thank you all for your comments!
Back to top
View user's profile Send private message
guy jax

New User


Joined: 05 Feb 2015
Posts: 2
Location: USA

PostPosted: Mon Mar 16, 2015 9:44 am
Reply with quote

Sachin,

I think that below is the reason of getting incorrect result...

Quote:
What I have done is I have shifted my initialization of output record after first read of an input file.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top