× 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.



Make sure the POI jar is in the CLASSPATH of the batch job.

> -------- Original Message --------
> Subject: Jakarta POI HSSF question...
> From: Shane_Cessna@xxxxxxx
> Date: Wed, May 25, 2005 11:29 am
> To: java400-l@xxxxxxxxxxxx
> 
> Hey all, 
> 
> I'm new to this list, so if this is a dumb question, forgive me...
> 
> Would there be any reason why the following code would work interactively 
> in an RPGLE program and not in a batch program?
> 
> D hssf_open       PR                  like(HSSFWorkbook)
> D   peFilename                1024A   const varying 
> ...
> D IFSfilename      s                   50a
> ...
> IFSfilename = '/home/scessna/excel/May05DailyLaborHours2.xls';
> book = hssf_open(IFSfilename);
> ...
> (in a service program)
> P hssf_open       B                   EXPORT 
> D hssf_open       PI                  like(HSSFWorkbook)
> D   peFilename                1024A   const varying 
> D jFileInputStream... 
> D                 S               O   CLASS(*JAVA 
> D                                     : 'java.io.FileInputStream')
> D jInputStream... 
> D                 S               O   CLASS(*JAVA 
> D                                     : 'java.io.InputStream') 
> D POIFSFilesystem... 
> D                 S               O   CLASS(*JAVA 
> D                                     : 'org.apache.poi.poifs- 
> D                                     .filesystem.POIFSFileSystem')
> D new_FileInputStream... 
> D                 pr              O   extproc(*JAVA 
> D                                     :'java.io.FileInputStream' 
> D                                     : *CONSTRUCTOR) 
> D  filename                           like(jString) const 
> D new_POIFSFileSystem... 
> D                 pr              O   extproc(*JAVA 
> D                                     :'org.apache.poi.poifs- 
> D                                     .filesystem.POIFSFileSystem'
> D                                     : *CONSTRUCTOR) 
> D  stream                             like(jInputStream) 
> D new_HSSFWorkbookFromPOIFS... 
> D                 PR                  like(HSSFWorkbook) 
> D                                     ExtProc(*JAVA: 
> D                                     'org.apache.poi.hssf.usermodel-
> D                                     .HSSFWorkbook': 
> D                                     *CONSTRUCTOR) 
> D  poifs                              like(POIFSFileSystem) 
> D closeFile       PR                  EXTPROC(*JAVA 
> D                                     :'java.io.FileInputStream' 
> D                                     :'close') 
> D wwStr           s                   like(jString) 
> D wwFile          s                   like(jFileInputStream)
> D wwPOIFS         s                   like(POIFSFileSystem) 
> D wwBook          s                   like(HSSFWorkbook) 
>  
>  /free 
>     wwStr   = new_String(peFilename); 
>     wwFile  = new_FileInputStream(wwStr); 
>     wwPOIFS = new_POIFSFileSystem(wwFile); 
>     wwBook  = new_HSSFWorkbookFromPOIFS(wwPOIFS); 
>     closeFile(wwFile); 
>     hssf_freeLocalRef(wwPOIFS);
>     hssf_freeLocalRef(wwFile); 
>     hssf_freeLocalRef(wwStr); 
>     return wwBook; 
>  /end-free 
> P                 E 
> 
> The file I'm looking for is found when I run this interactively, but not 
> in batch...file is "/home/scessna/excel/May05DailyLaborHours2.xls"
> 
> Initially, I thought that maybe when a job is submitted to batch, it has a 
> default current directory...I tried calling a CL that changed the 
> submitted jobs current directory, then calling my program, but that didn't 
> work either...is this a bug in the HSSF routines or am I just overlooking 
> something.
> 
> Thanks.
> 
> Shane
> -- 
> This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
> mailing list
> To post a message email: JAVA400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.