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



I've been working with the HSSF4 Java POI procedures that I downloaded from the links previously listed on this mail list. I was able to get an RPG program to write out to a new Excel spreadsheet but I am having a problem getting a program to read from
an existing Excel spreadsheet.

I've included the error message, section of code in the HSSF4 service program where the error is occuring and the entire RPG program that I am calling. This program
is a version of the UPDDEMO RPG program that was part of the code in the
www.iseriesnetwork.com/noderesources/code/clubtechcode/ExcelCrtDemo.zip examples.

Does anyone know why I am receiving the following error? The error is occuring on
the following line in the RPG program:

book = hssf_open('/excel/BBNExpress.xls');

Thanks!


Here's the detailed message that I am receiving:

Message ID . . . . . . :   RNX0301       Severity . . . . . . . :   50

Message . . . . :   Java exception received when calling Java method.
Cause . . . . . :   RPG procedure HSSF_OPEN in program CBSCUSTM/HSSFR4
 received Java exception "java.lang.UnsatisfiedLinkError:" when calling
 method "<ini" with signature "" in class
 "org.apache.poi.hssf.usermodel.HSSFWorkbook".


Below is the section of the HSSFR4 service program where the error occurred.
The error occurred on line 1266 / 126500.

Program:   HSSFR4         Library:   CBSCUSTM       Module:   HSSFR4
 1262     126100  /free
 1263     126200     wwStr   = new_String(peFilename);
 1264     126300     wwFile  = new_FileInputStream(wwStr);
 1265     126400     wwPOIFS = new_POIFSFileSystem(wwFile);
1266 126500 wwBook = new_HSSFWorkbookFromPOIFS(wwPOIFS); <--- Error
 1267     126600
 1268     126700     closeFile(wwFile);


Here is the entire RPG program.  The HSSFR4 service program is part of the
OSBBNDDIR binding directory.


H DFTACTGRP(*NO)
H OPTION(*SRCSTMT: *NODEBUGIO: *NOSHOWCPY)
H THREAD(*SERIALIZE)
H BNDDIR('OSBBNDDIR' : 'QC2LE')

/copy qOSBCPYSRC,hssf_h

D book            s                   like(HSSFWorkbook)
D sheet           s                   like(HSSFSheet)
D row             s                   like(HSSFRow)
D cell            s                   like(HSSFCell)
D TempStr         s                   like(jString)
D StrVal          s             52A   varying
D NumVal          s              8F
D type            s             10I 0

D String_getBytes...
D                 pr          1024A   varying
D                                     extproc(*JAVA:
D                                     'java.lang.String':
D                                     'getBytes')

* Put environment variable
D PutEnv          pr            10i 0 ExtProc('putenv')
D  EnvVar                         *   value options(*string)

D rc              s             10i 0
/free

 // set CLASSPATH environment
 rc = putenv('CLASSPATH=/excel/POI-2.0.jar');

 hssf_begin_object_group(100);

 // Load the BBN Express Spreadsheet into memory
 book = hssf_open('/excel/BBNExpress.xls');   <--- Error

 // Get the cell
 sheet = hssf_getSheet(book: 'Sept 20');
 row   = HSSFSheet_getRow(sheet: 2);
 cell = HSSFRow_GetCell(row: 2);
 type = HSSFCell_getCellType(cell);
 StrVal = 'Cell B2 = ';

  select;
  when type = CELL_TYPE_STRING;
     StrVal +=
       String_getBytes(HSSFCell_getStringCellValue(cell));
  when type = CELL_TYPE_FORMULA;
     StrVal += String_getBytes(HSSFCell_getCellFormula(cell));
  when type = CELL_TYPE_NUMERIC;
     NumVal = HSSFCell_getNumericCellValue(cell);
     StrVal += %char(%dech(NumVal:15:2));
  endsl;

  dsply StrVal;

  hssf_save(book: '/excel/BBNExpress.xls');
  hssf_end_object_group();

  *inlr = *on;

/end-free

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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.