searching files into a table 
Author Message
 searching files into a table

Hi,
i am using netexpress 3.0 and i search for a method to fill a table with the
filenames from a selected directory, eg c:\*.dat.

Can anyone help me?

Thanks, Wulf



Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table
Hi Wulf,

not a method but a function which may solve your problems:

X"91" function 69 - Scan Directory

X"91" function 69

Searches a directory for a given file specification.

call X"91" using result
                 function-code
                 parameter

Parameters:
result  Group item defined as:
    f-error         pic x comp-x
    f-handle        pic x(2) comp-x
    f-attrout       pic x comp-x
    f-time          pic x(2) comp-x
    f-date          pic x(2) comp-x
    f-size          pic x(4) comp-x
    f-fileout       pic x(<n>)
function-code   pic x comp-x
parameter       Group item defined as:
    f-action        pic x comp-x
    f-attrin        pic x comp-x
    f-filein        pic x(<m>)

you should refer to your online help for further details....

HTH - Stefan Meyer



Quote:
> Hi,
> i am using netexpress 3.0 and i search for a method to fill a table
with the
> filenames from a selected directory, eg c:\*.dat.

> Can anyone help me?

> Thanks, Wulf

Sent via Deja.com http://www.deja.com/
Before you buy.


Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table
Hi Wulf,

You can use the X"91" function 69 call to get the files that are in a
directory. The various parameters and options are documented in the online
help.

Regards
David.


Quote:
> Hi,
> i am using netexpress 3.0 and i search for a method to fill a table with
the
> filenames from a selected directory, eg c:\*.dat.

> Can anyone help me?

> Thanks, Wulf



Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table

Quote:

> Hi,
> i am using netexpress 3.0 and i search for a method to fill a table with the
> filenames from a selected directory, eg c:\*.dat.

> Can anyone help me?

> Thanks, Wulf

Can you just go to the command line and type DIR C:\*.DAT > FILENAMES
??


Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table

Quote:

> Hi,
> i am using netexpress 3.0 and i search for a method to fill a table with the
> filenames from a selected directory, eg c:\*.dat.

> Can anyone help me?

Wulf,

You should be able to adapt the following to your needs. Then you could
fill a listbox with an ordered/sorted collection - check also File
common dialog. I don't use it but I think you will find an example of a
file tree in the module Dialog System.

Jimmy, Calgary AB

----------------------------------------------------------------------
Class : Create Ascii - I'm using NetExpress to convert some old RM/COBOL
74 data files to temporary files, so that I can generate one
ascii-delimited from info in three data files. Having produced the
ascii-delimited now I want to delete those temporary files :-

*>--------------------------------------------------------------
Method-id. "delete-files".                                      
*>-------------------------------------------------------------  
Working-storage section.                                        

*> Total length must be 50 chars :-                              

01 ws-TempName.                                                  
   05                       pic x(12) value "c:\ndt\temp\".      
   05 wst-ClientFacility    Pic x(07).                          
   05                       pic x(03) value "*.*".              
01 ws-WildCardName          pic x(50).                          

Local-storage section.                                          
01 ls-program                   object reference.                
Procedure Division.                                              
   invoke FileNames2 "new" returning ls-program                  
   move   ws-ClientFacility       to wst-ClientFacility          
   move   ws-TempName             to ws-WildcardName            
   invoke ls-program "delete-using-wildcard"                    
          using ws-WildCardName                                  
   invoke ls-program "finalize" returning ls-program            

Exit Method                                                      
End Method "delete-files".                                      
*>-------------------------------------------------------------  

*>------------------ filenam2.cbl --------------------------    

Class-id.       FileNames2                                      
                inherits from Base.                              

Class-control.  FileNames2           is class "filenam2"        

                CharacterArray       is class "chararry"        
                FileName             is class "filename"        
.                                                                

*> Coded as a separate class so that more methods can be added  
*> later                                                        

*>--------------------------------------------------------------
FACTORY.                                                        
*>--------------------------------------------------------------
Method-id. "new".                                                
*>--------------------------------------------------------------
Linkage Section.                                                
01 lnk-self                     object reference.                
Procedure Division returning lnk-self.                          
  invoke super "new" returning lnk-self                          
End Method "new".                                                
*>-------------------------------------------------------------  
END FACTORY.                                                    
*>-------------------------------------------------------------  
OBJECT.                                                          
*>--------------------------------------------------------------
WORKING-STORAGE SECTION.                                        

*>--------------------------------------------------------------
OBJECT-STORAGE SECTION.                                          

*>-------------------------------------------------------------  
Method-id. "delete-using-wildcard".                              
*>-------------------------------------------------------------  
Local-storage section.                                          
01 n                         pic x(4) comp-5.                    
01 ls-collection             object reference.                  
01 ls-filename               pic x(100).                        
01 ls-length                 pic x(4) comp-5.                    
01 ls-size                   pic x(4) comp-5.                    
01 ls-StatusCode             pic x(4) comp-5.                    
01 ls-string                 object reference.                  

Linkage section.                                                
01 lnk-WildCardName          pic x(50).                          
Procedure Division using lnk-WildCardName.                      

 move length of lnk-WildCardName to ls-length                    
 invoke CharacterArray "withLengthValue"                        
        using     ls-length                                      
                  lnk-WildCardName                              
        returning ls-string                                      
 invoke FileName "expandwildcards" using     ls-string          
                                   returning ls-Collection      
 invoke ls-Collection "size" returning ls-size                  

 perform varying n from 1 by 1 until n > ls-size                
    move spaces to ls-filename                                  
    invoke ls-Collection "at" using n returning ls-string        
    invoke ls-string "getValueZ" returning ls-filename          
    call "CBL_DELETE_FILE" using     ls-filename                
                           returning ls-StatusCode              
 End-perform                                                    

 invoke ls-Collection "deepfinalize" returning ls-Collection    

End Method "delete-using-wildcard".                              
*>---------------------------------------------------------------
Method-id. "get-ascii-filenames".                                
*>-------------------------------------------------------------  
Local-storage section.                                          
01 n                         pic x(4) comp-5.                    
01 ls-filename               pic x(100).                        
01 ls-length                 pic x(4) comp-5.                    
01 ls-size                   pic x(4) comp-5.                    
01 ls-StatusCode             pic x(4) comp-5.                    
01 ls-string                 object reference.                  

Linkage section.                                                
01 lnk-WildCardName          pic x(50).                          
01 lnk-collection            object reference.                  

Procedure Division using     lnk-WildCardName                    
                   returning lnk-collection.                    

 move length of lnk-WildCardName to ls-length                    
 invoke CharacterArray "withLengthValue"                        
        using     ls-length                                      
                  lnk-WildCardName                              
        returning ls-string                                      
 invoke FileName "expandwildcards" using     ls-string          
                                   returning lnk-Collection      
Exit Method                                                      
End Method "get-ascii-filenames".                                
*>---------------------------------------------------------------

End OBJECT.                                                      
End CLASS FileNames2.                                            

*>--------------------------------------------------------------



Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table

Quote:

> Can you just go to the command line and type DIR C:\*.DAT > FILENAMES
> ??

Sure he can, but remember he "wants to fill a table" - didn't specify
what type of table, Working-Storage, (ouch, how big ?) or does he want
to display it in a dialog for user selection and open appropriate file.

Howard, get busy. Now go and sort those JCL cards into the right order
<G>

Jimmy



Sat, 18 Jan 2003 03:00:00 GMT  
 searching files into a table

Quote:

> > Can you just go to the command line and type DIR C:\*.DAT > FILENAMES
> > ??

> Sure he can, but remember he "wants to fill a table" - didn't specify
> what type of table, Working-Storage, (ouch, how big ?) or does he want
> to display it in a dialog for user selection and open appropriate file.

If this is for the Windows platform, I would recommend FindFirstFile and
FindNextFile functions in the API. I even believe I have some code
somewhere.

Quote:
> Howard, get busy. Now go and sort those JCL cards into the right order

:-) You guys are amazing.

Cheesle



Sun, 19 Jan 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Search for a value in a Clarion table

2. Forth Oriented Recycable Table Heap Search or F.O.R.T.H.S.

3. Searching a DB2/2 Table

4. SEARCH syntax, table

5. Problem with linear search on an internal table

6. HELP: Searching a 2 dimensional array/table

7. Making Table Searches Efficient Using Perform Varying

8. Search Table Problem

9. Multi-dimensional table SEARCH correction

10. Searching Tables

11. PHP search script in MySQL table

12. Stroring multiple tables in a single .tps file vith a variable file name

 

 
Powered by phpBB® Forum Software