New version but old error not corrected? and new function not implemented.

Scott Klement's tool for processing CSV files in an RPG program. http://www.scottklement.com/csv/
Post Reply
peder udesen
Posts: 14
Joined: Thu Jul 29, 2021 8:00 am

New version but old error not corrected? and new function not implemented.

Post by peder udesen »

Hi Scott

I have found out you have made a new version of CSVR4 that can handle UTF. Excellent.

But I have 2 questions.

1)
But when I'm looking in the source it looks like you haven't corrected an error that was reported in 2010:

Employee_ID,StateCode,FilingStatus
51,,
A1,TX,
B3,OK,S
The first 2 records will not return the correct number of fields, while the third one will.


Am I right?


2)
In 2009 you suggested a function to load a record from user-supplied string called CSV_loadbuffer().
The code was the following. But it seems you haven't implemented it in the new version.

Code: Select all

      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
      * CSV_loadrec(): Load a record from a delimited file into memory    
      *                                                                   
      *     peHandle = (i/o) handle to file returned by CSV_open()        
      *                                                                   
      * Returns *ON if successful, *OFF upon failure or EOF               
      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
     P CSV_loadrec     B                   export                         
     D CSV_loadrec     PI             1N                                  
     D   peHandle                          like(CSV_HANDLE) value         
                                                                          
     D CSV             DS                  likeds(CSVFILE_t)              
     D                                     based(peHandle)                
                                                                          
     D p_buf           s               *                                  
     D len             s             10I 0                                
                                                                          
      /free                                                               
                                                                          
         %len(CSV.buf) = %size(CSV.buf) - VARPREF;            
                 %len(CSV.buf) = len;                            
                                                        
        if (%subst(CSV.buf : len : 1) = LINEFEED );     
           len = len - 1;                               
           %len(CSV.buf) = len;                         
        endif;                                          
                                                        
        if (%subst(CSV.buf : len : 1) = CARRTN );       
           len = len - 1;                               
           %len(CSV.buf) = len;                         
        endif;                                          
                                                        
        csv_rewindrec(peHandle);                        
                                                        
        return *ON;                                     
     /end-free                                          
    P                 E                                             
         
Regards
Peder

PS: I have pdf-files with the old entries from Systemi Networks Forum ( long gone ) but I'm not allowed to attach them.
Scott Klement
Site Admin
Posts: 614
Joined: Sun Jul 04, 2021 5:12 am

Re: New version but old error not corrected? and new function not implemented.

Post by Scott Klement »

I'm not familiar with CSV_loadbuffer, but there is an CSV_openbuf in the current release. Will that help?
peder udesen
Posts: 14
Joined: Thu Jul 29, 2021 8:00 am

Re: New version but old error not corrected? and new function not implemented.

Post by peder udesen »

Have you checked if the old bug has been fixed or still exists?

Regards
Peder
peder udesen
Posts: 14
Joined: Thu Jul 29, 2021 8:00 am

Re: New version but old error not corrected? and new function not implemented.

Post by peder udesen »

Please forgive me. I put the wrong source in the above example for CSV_loadbuffer()

Here it is:

Code: Select all

 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++      
 * CSV_loadbuffer(): Load record from user-supplied string.            
 *                                                                     
 *     peHandle = (i/o) handle to file returned by CSV_open()          
 *        peBuf = (input) data to load into record buffer              
 *                                                                     
 * Returns *ON if successful, *OFF upon failure or EOF                 
 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++      
P CSV_loadbuffer  B                   export                           
D CSV_loadbuffer  PI             1N                                    
D   peHandle                          like(CSV_HANDLE) value           
D   peBuf                    65502a   varying const options(*varsize)  
                                                                       
D CSV             DS                  likeds(CSVFILE_t)                
D                                     based(peHandle)                  
                                                                       
 /free                                                                 
    CSV.buf = peBuf;                                                   
    csv_rewindrec(peHandle);                                           
    return *ON;         
 /end-free 
P                                                         
peder udesen
Posts: 14
Joined: Thu Jul 29, 2021 8:00 am

Re: New version but old error not corrected? and new function not implemented.

Post by peder udesen »

Do any of you know if the old bug has been fixed in the new version?
Scott Klement
Site Admin
Posts: 614
Joined: Sun Jul 04, 2021 5:12 am

Re: New version but old error not corrected? and new function not implemented.

Post by Scott Klement »

CSV_loadbuffer was from a forum discussion, and has never officially been a part of the CSVR4 tool. Is this something you think should be added? If so, can you explain why you would use this instead of CSV_openBuf?

I don't agree with the other proposed change ("bug fix").
peder udesen
Posts: 14
Joined: Thu Jul 29, 2021 8:00 am

Re: New version but old error not corrected? and new function not implemented.

Post by peder udesen »

Thank you for your response. I didn't want to offend you.
sarika78
Posts: 2
Joined: Mon Jan 08, 2024 7:57 am

Re: New version but old error not corrected? and new function not implemented.

Post by sarika78 »

Hello guys
"I'm disappointed with the most
top followrecent update—anticipated new features are absent, and old faults still exist. It's annoying to see important problems disregarded in favor of improvements. Wishing for a speedy resolution and extensive enhancements in the upcoming release." ;) :(
Post Reply