Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Read command with SET and INTO working differently in PL1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Read command with SET and INTO working differently in PL1
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: 1002
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Feb 23, 2011 1:10 pm    Post subject:
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    Post subject:
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: 1072
Location: Oostende, Belgium

PostPosted: Wed Feb 23, 2011 10:37 pm    Post subject:
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: 1002
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Feb 24, 2011 12:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OUTREC with ALter Command scorp_rahul23 DFSORT/ICETOOL 1 Wed Nov 22, 2017 3:10 pm
No new posts REXX LISTDSI () SMSINFO is not working upendrasri CLIST & REXX 4 Fri Nov 17, 2017 11:33 am
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts MQ command in option 6 of ISPF! Vignesh Sid All Other Mainframe Topics 3 Tue Sep 26, 2017 6:01 pm
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us