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

Read command with SET and INTO working differently in PL1


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Feb 23, 2011 7:43 am
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Feb 23, 2011 1:10 pm
Reply with quote

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
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Feb 23, 2011 9:49 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Feb 23, 2011 10:37 pm
Reply with quote

These snippets of code do not contain any useful information.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Feb 24, 2011 12:16 pm
Reply with quote

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
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
Search our Forums:

Back to Top