View previous topic :: View next topic
|
Author |
Message |
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
I presume this is the problem with the Blockzise of the file. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Are you specifying RECORD CONTAINS 0 CHARACTERS in FD entry? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
Yes , we are specifying "RECORD CONTAINS 0 CHARACTERS" in FD entry.
Record struct in program is greater than actual. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Reshmi,
Did you check for the possibility that you may be referring memory beyond the record size? |
|
Back to top |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Reshmi
New User
Joined: 06 Oct 2005 Posts: 9
|
|
|
|
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 |
|
|
|