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

Variable file read - Error


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

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue May 26, 2009 6:28 pm
Reply with quote

I am trying to read a variable length file (max length = 604).
The first record is 169 and second 183.
The first read is working fine, but the second read is giving S-002 error.

The length of the second record displayed is 16444 instead of 183.

Any help on this?


S-002


DESCRIPTION: S002-04 - AN ERROR OCCURRED IN PROCESSING A SEQUENTIAL OR INDEXED

SEQUENTIAL DATA SET, OR IN CREATING A DIRECT ACCESS DATA SET.

REFER TO MESSAGE IEC036I DISPLAYED IN JES MSGLOG OF THE JOB THAT ENDED. THE 2 BYTES RETURN CODE TO THE RIGHT OF THE ABEND CODE IDENTIFIES THE ERROR.

POSSIBLE CAUSES: 04 - AN ERROR OCCURRED IN READING A SEQUENTIAL DATA SET:

1. THE VARIABLE RECORD LENGTH WAS LESS THAN 4.
2. THE LRECL WAS GREATER THAN THE DCB LRECL.
3. AN ERROR OCCURRED IN SEQUENTIAL PROCESSING OF VARIABLE
LENGTH SPANNED RECORDS WHICH WERE NOT IN SEQUENCE

TO CORRECT:
1. VARIABLE RECORD LENGTH MUST INCLUDE 4 BYTES OF RDW.
BLKSIZE MUST BE LRECL OR MULTIPLES OF LRECL PLUS 4 BYTES
OF BDW.

2. RECREATE THE DATA SET SPECIFYING THE CORRECT DCB INFORMATION.

3. RECREATE THE DATA SET SO THAT THE SPANNED RECORDS
ARE IN THE CORRECT SEQUENCE.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Tue May 26, 2009 7:20 pm
Reply with quote

Quote:
The length of the second record displayed is 16444 instead of 183.
Where is the length displayed and how have you ascertained that the length is 183 for the second read, Show us the Select and FD of the file declared and your logic for read clause.

WTH
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue May 26, 2009 7:58 pm
Reply with quote

SELECT TED01GDW ASSIGN TO TED01GDW

ACCESS MODE IS SEQUENTIAL

FILE STATUS IS WW-TED01GDW-STATUS.



===========

FD TED01GDW

RECORDING MODE IS V

BLOCK CONTAINS 0 RECORDS

LABEL RECORDS ARE STANDARD

RECORD IS VARYING IN SIZE FROM 1 TO 600

DEPENDING ON WW-TED01GDW-LENGTH.

01 TED01GDW-RECORD PIC X(600).



====READ=======



READ TED01GDW AT END

MOVE 'Y' TO WF-EOF-INPUT

END-READ



DISPLAY 'LENGTH OF REC = ' WW-TED01GDW-LENGTH
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: Tue May 26, 2009 8:38 pm
Reply with quote

Where did the input data file come from? Was it transferred from another system? If so, what kind of system was it transferred from?
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Tue May 26, 2009 8:46 pm
Reply with quote

kalukakkad,
if the READ operation is successful then WW-TED01GDW-LENGTH will hold the number of the character positions of the record just read.
If the READ operation is unsuccessful then WW-TED01GDW-LENGTH , will hold the value it had before the READ operation was attempted.

As per your understanding 169 length records was successfully read, your second read failed ,so the value of WW-TED01GDW-LENGTH should have been 169 but it is 16444. Was this value manipulated some where in the program.

WTH.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue May 26, 2009 8:48 pm
Reply with quote

no, nowhere in the program, the record length is being manipulated.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Tue May 26, 2009 8:59 pm
Reply with quote

Display value of variable WW-TED01GDW-LENGTH before and after read , and by physically opening the file you determined that the second record is of length 183.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed May 27, 2009 5:03 am
Reply with quote

Can you show us how the file was defined in the JCL? What was the LRECL and BLKSIZE, RECFM?

How was WW-TED01GDW-LENGTH defined in the pgm?
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top