View previous topic :: View next topic
|
Author |
Message |
anjani shanker
New User
Joined: 26 Jan 2007 Posts: 37 Location: USA
|
|
|
|
Hi -
I faced a trouble this evening where in one of my modules, where I was reading a file sequencially wasn't working fine with the "SET(REC_PTR)" clause after certain number of reads..Yes there were huge amoung of data in the file.
My module was compiled with xpeditor option as Y. When i changed the read stmt to "INTO(REC_VAR)" instead of set, it was working fine. The read was performed in the one of the called modules and the record variable was allocated in the main module. Also want to bring this into the attention that the read wasn't going down but it was carrying some values it had already read from the file long back..Was this storage overlay issue or something else? Could you also forward me some links where i could study more about this? |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
The read was performed in the one of the called modules and the record variable was allocated in the main module. |
This is likely where your issue lies. READ SET(REC_PTR) sets the address of REC_PTR to the record in the I/O buffer - it does not move data into a record variable.
How is the record variable declared and how is the READ issued?
Without seeing your code it's not possible to see how you're managing to cause this situation. It looks like you have a 'short' buffer and are managing to address records that are from a previous buffer when you reach end-of-file.
Garry. |
|
Back to top |
|
|
anjani shanker
New User
Joined: 26 Jan 2007 Posts: 37 Location: USA
|
|
|
|
I have attached the piece of code. In MXXXX below
READ FILE(INFILE) INTO(K406); returns correct value
but when i used
READ FILE(INFILE) SET(REC_PTR); after being called sometimes it started returning some old values which were read earlier and not a part of current read.
Main Module:
Code: |
DCL
1 CNTL_REC BASED(CNTL_PTR),
% INCLUDE SYSLIB (K406PAB );
DCL
CNTL_PTR POINTER; |
Inside my logic i call MXXXX couple of times which performs the read.
Code: |
CALL MXXXX(EOF,CNTL_PTR,CUR_ST_AGT); |
Called Module, MXXXX:
Code: |
MXXXX:
PROC (EOF,REC_PTR,CUR_ST_AGT) REORDER;
DCL
INFILE FILE INPUT RECORD
ENV( FB,RECSIZE(250));
DCL
1 K406 BASED(REC_PTR),
% INCLUDE SYSLIB (K406PAB );
% SKIP(001);
ON ENDFILE(INFILE)
EOF = '1'B;
IF FIRST_CALL THEN
DO;
OPEN FILE(INFILE);
FIRST_CALL = '0'B;
END;
READ FILE(INFILE) INTO(K406);
CUR_ST_AGT = K406.CUR_ST_AGT; |
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
These snippets of code do not contain any useful information. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
These snippets of code do not contain any useful information. |
...and, since there's no definitive value in the calling module's CNTL_PTR which is passed to the called program as REC_PTR, the READ INTO is liable to result in a S0C4 abend.
Garry. |
|
Back to top |
|
|
|