× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



List Hi,

I am trying to read an IFS file using the C function "read". I am getting the 
error message MCH1210. (Receiver value too small to hold result).

Sample of the code:
                                                      
 * Read - Read an IFS file                            
D read            PR            10I 0 ExtProc('read') 
D  filedescI                    10I 0 Value           
D  bufferI@                       *   Value           
D  nbyte                        10U 0 Value           

0143.00                                       
0144.00  * Read PC File in IFS directory      
0145.00 D Pr_ReadFile     PR         10240A   

0228.00 D OutRec          S          10240A                       
0229.00 D FileDescI       S             10I 0                     
0230.00 D BufferI         S          10240A   Inz(*Blank)         
0231.00 D  BufferI@       S               *   Inz(%Addr(BufferI)) 
0232.00 D NBytes          S             10U 0                     
0233.00 D NBytesSet       S             10U 0 Inz(10240)          
0234.00 D RecIn           S          10240A                       
0235.00 D CLRFPos         S             10I 0 Inz(0)              
0236.00 D CLRF            S              2A   Inz(x'0d25')        

0426.00                                         
0427.00     // Read PC file in IFS directory    
0428.00   Monitor;                              
0429.00     outrec = Pr_ReadFile ();            
0430.00   On-Error;                             
0431.00     ExSr *Pssr;                         
0432.00   EndMon;                               

 859.00 P Pr_ReadFile     B                                                    
0860.00                                                                        
0861.00 D  Pr_ReadFile    PI           10240A                                   
 
0862.00                                                                        
0863.00                                                                        
0864.00  /free                                                                 
0865.00                                                                        
0866.00   NBytes = Read(FileDescI:BufferI@:NBytesSet);                         
0867.00                                                                        
0868.00   If NBytes > 0 And                                                    
0869.00                                                                        
0870.00       FileDescI >= 0;                                                  
0871.00                                                                        
0872.00         ClRfPos =%Scan(CLRF:BufferI);                                  
0873.00                                                                        
0874.00         If ClRfPos > 0;                                                
0875.00            RecIn = %SubSt(BufferI:1:ClRfPos + 1);                      
0876.00         EndIf;                                                         
0877.00                                                                        
0878.00   EndIf;                                                               
0879.00                                                                        
0880.00                                                                        
0881.00   Return RecIn;                                                        
0882.00                                                                        
0883.00  /end-free                                                             
0884.00                                                                        
0885.00 P Pr_ReadFile     E                                                    


Before I attempt to read the file I set the IFS file details  and open the file 
in the IFS directory.  I set the file record length to 10240 in the hope that 
it will be sufficient to hold the stream.

Regards,

Emmanuel Zannis
(Tel:  01252 372000 x3262
 Fax: 01252 542261
 e-mail:emmanuel.zannis@xxxxxxxxxxx 


The above information is confidential to the addressee and may be privileged.  
Unauthorised access and use is prohibited. If you received this message in 
error please tell us by reply (or telephone the sender) and delete all copies 
from your system.

Internet communications are not secure and therefore this Company does not 
accept legal responsibility for the contents of this message. This e-mail 
message has been swept by Integralis e:)scan for the presence of detectable 
computer viruses, but we cannot guarantee that it is virus-free and you should 
scan this email for viruses prior to opening or saving any attachments.

If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.

Please note that communications sent by or to any person through our computer 
systems may be viewed by other members of the Hogg Robinson group.

Hogg Robinson plc
Registered Office: Global House, Victoria Street, Basingstoke, Hampshire RG21 
3BT
Registered in England and Wales No 2107443


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.