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

Program abends with SOC4 while reading the 231st record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Thu Apr 10, 2008 3:42 pm
Reply with quote

Hi all,

We need a program that will be able to take input file of any length and extract only specific data from it. This means if today we execute the program with length of 300, next day we may execute it with an input file of length 400.

For this we declared the input file to have size 10000 (the max possible size of any file in our system) in FD section. In this way program takes file of any record length.

Now we see that when we give an input file of length 440, the program abends with SOC4 while reading the 231st record. So just for debugging purpose we increased the file length in FD section to 10440(10000+ input file length), and then we see that program abends upon reading 230th record. We have confirmed that it is not because of data error.

Could someone please provide us with some solution for this.
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 Apr 10, 2008 3:54 pm
Reply with quote

Is the file defined as VARIABLE LENGTH in the program and is the file truly Variable Length?

Judging by what you've posted, the answer to both of these questions is YES!

Bill
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Thu Apr 10, 2008 4:01 pm
Reply with quote

Thanks for the response.

The input file format will always be FB,only the record length (LRECL) will change.

So the file is not defined as variable length and it will not be of variable length.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Thu Apr 10, 2008 4:10 pm
Reply with quote

I presume this is the problem with the Blockzise of the file.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Apr 10, 2008 4:18 pm
Reply with quote

Suppose if u have specified 10000 as record length in ur cobol program
and if u give 440/anyother other than 10000 than u will get File-status 39 "File Attributes Mismatch".
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Apr 10, 2008 4:25 pm
Reply with quote

Are you specifying RECORD CONTAINS 0 CHARACTERS in FD entry?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Apr 10, 2008 4:33 pm
Reply with quote

sri_mf wrote:
Suppose if u have specified 10000 as record length in ur cobol program
and if u give 440/anyother other than 10000 than u will get File-status 39 "File Attributes Mismatch".


Not if RECORD CONTAINS 0 CHARACTERS specified in FD entry. Program will accept input file with any length. If the record struct in program is shorter than actual, then record will be truncated. If it is greater then only the area = record length can be addressed. If tried to access area beyond then Addressing exceptions (s0c4 etc.) may be encountered.
This may be happening with OP, just a guess..
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Thu Apr 10, 2008 4:51 pm
Reply with quote

Yes , we are specifying "RECORD CONTAINS 0 CHARACTERS" in FD entry.
Record struct in program is greater than actual.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Apr 10, 2008 4:55 pm
Reply with quote

agkshirsagar wrote:
sri_mf wrote:
Suppose if u have specified 10000 as record length in ur cobol program
and if u give 440/anyother other than 10000 than u will get File-status 39 "File Attributes Mismatch".


Not if RECORD CONTAINS 0 CHARACTERS specified in FD entry. Program will accept input file with any length. If the record struct in program is shorter than actual, then record will be truncated. If it is greater then only the area = record length can be addressed. If tried to access area beyond then Addressing exceptions (s0c4 etc.) may be encountered.
This may be happening with OP, just a guess..


Thanks abhijit for correcting me.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Apr 10, 2008 5:07 pm
Reply with quote

Reshmi,
Did you check for the possibility that you may be referring memory beyond the record size?
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Thu Apr 10, 2008 5:23 pm
Reply with quote

Record length of our input file is 440 and we are reading this in to record struct of X(10000).
Can you please tell us how to check if it is referring beyond the record size
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 10, 2008 9:36 pm
Reply with quote

Odds are that is is failing with the last record in the block....
Simplest solution, is define the file 'undefined' and unblocked, read the block as an undefined record and start extracting each currently defined (for this run) record out of the undifined block.....
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 Apr 10, 2008 10:10 pm
Reply with quote

If you create and read the file as a true variable-length, specify the following in your FD -
Code:

RECORD IS VARYING IN SIZE FROM nnnnn TO nnnnn CHARACTERS DEPENDING ON WS-RECORD-LGTH.

With the first series of nnnnn representing the minimum-length and the second series of nnnnn representing the maximum-length.

Then, in WS, specify -
Code:

03  WS-RECORD-LGTH PIC  9(08) BINARY.

Note that WS-RECORD-LGTH must be UNSIGNED (as illustrated). My own preference is a binary-fullword, but a 9(05) PACKED-DECIMAL or 9(05) DISPLAY will also work.

Your COBOL version/release must be COBOL2 or greater.

Regards,

Bill
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 11, 2008 12:22 am
Reply with quote

Hello,

What is the blksize for your file? How many records are in the file?

What happens if you run a test where the FD specifies the exact record length?

Does this program have an internal sort? When an nternal sort is ungracefully terminated, an 0c4 often results.
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Mon Apr 14, 2008 8:10 am
Reply with quote

The input file has about 999 records.
when we ran a test version with FD specifying exact record length, the program runs fine with no abends.

The program does not have any internal sort.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 14, 2008 8:28 am
Reply with quote

Hello,

Please post the SELECT and FD from the cobol program.

Also, please post the dataset information from tso/ispf 3.4.

If it is available, please post the jcl from the process that creates the file.
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Tue Apr 15, 2008 1:27 pm
Reply with quote

SELECT clause from COBOL program:
---------------------------------------------
SELECT INPUT-FILE
ASSIGN TO UT-S-INPFILE1
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-FILE-STATUS.

FD from COBOL program
-----------------------------
FD INPUT-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 0 CHARACTERS
LABEL RECORDS ARE STANDARD.
01 INPUT-REC PIC X(10000).

Input dataset information from 3.4
-----------------------------------------
General Data
Management class . . :DEVL
Storage class . . . : BASE
Volume serial . . . : DP3050 +
Device type . . . . : 3390
Data class . . . . . : **None**
Organization . . . : PS
Record format . . . : FB
Record length . . . : 440
Block size . . . . : 27720
1st extent cylinders: 1
Secondary cylinders : 1

Sorry, the JCL that creates the file is not available.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 15, 2008 11:42 pm
Reply with quote

Hello,

As an experiment, could you change the input record definition from
Code:
01 INPUT-REC PIC X(10000).
to
Code:
01 INPUT-REC PIC X(30000).
?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Tue Apr 15, 2008 11:58 pm
Reply with quote

Since you are using COBOL in a manner that it is not designed for you should expect to run into problems like this.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 16, 2008 12:17 am
Reply with quote

Craq Giegerich wrote:
Since you are using COBOL in a manner that it is not designed for you should expect to run into problems like this.
Sorry to disagree, but the manual does say that RECORD CONTAINS 0 is valid and the actual record size is taken from the DD statement parameters.
If this length could change each run, then the DD reclen value would have to change with it. A SET variable would work nice and could also be passed down to the program via parm for a read into a ws ODO area set by that same size.....
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 16, 2008 1:27 am
Reply with quote

CICS GUY,

You got me on that one just don't beat me again. I wonder if the file was created and then more records were added it a different step. Maybe use IDCAMS or DITTO to dump that part of file and see what is there.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 16, 2008 1:34 am
Reply with quote

Hello,

Quote:
Since you are using COBOL in a manner that it is not designed for you should expect to run into problems like this.
Gee, i hope not.

That has been very handy for a long, long time. . .
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Wed Apr 16, 2008 2:47 pm
Reply with quote

We tried by changing the input file rec definition to X(30000),then
we see that program abends for 185th record. It works perfectly for
first 184 records.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 16, 2008 7:23 pm
Reply with quote

Reshmi wrote:
We tried by changing the input file rec definition to X(30000),then
we see that program abends for 185th record. It works perfectly for
first 184 records.
What does your JCL look like?
Back to top
View user's profile Send private message
Reshmi

New User


Joined: 06 Oct 2005
Posts: 9

PostPosted: Fri Apr 18, 2008 7:17 pm
Reply with quote

Hi all,

Sorry for the delay in responding.
We have now fixed that issue.

Before we were reading the input file to a ws-variable record of x(10000).
our input file was of just size 440, and we were getting SOC4 during read.

From the below link : "http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol.doc_3.4/rlfdere1.htm
we read that
"The RECORD CONTAINS 0 CHARACTERS clause can be specified for input QSAM files containing fixed-length records; the record size is determined at run time from the DD statement parameters or the data set label. If, at run time, the actual record is larger than the 01 record description, then only the 01 record length is available. If the actual record is shorter, then only the actual record length can be referred to. Otherwise, uninitialized data or an addressing exception can be produced"

So we now declared our ws variable as:
01 ws-var.
05 WS-EXT1 PIC X OCCURS 1 TO 10000 DEPENDING ON
WS-RECLEN.

and before reading the file we move the length of the file 440 that
we now pass from JCL to WS-RECLEN.
While reading, we then read the file into 01 variable and it works fine.

Thanks a lot to all of you for spending time to help us out.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
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
Search our Forums:

Back to Top