Wes,
I don't know if it has anything to do with the java error you received,
but...
I had to use double quotes (x'7F') to do a similar thing once.
Mike 
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [
mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Wes Palmer
Sent: Wednesday, June 20, 2007 6:52 PM
To: rpg400-l@xxxxxxxxxxxx
Cc: Wes Palmer
Subject: Question regarding "=PROPER" Function in POI
I have a question regarding implementation of the Excel function "=PROPER"
using POI. I have successfully applied POI in numerous programs so I can
create spreadsheets that I then e-mail out to users. I have tried, without
success, to implement the Excel function "=PROPER". 
The error I receive, upon execution of my program, is "Java exception
received when calling Java method (C G D F)."
Here are the pertinent sections of code. File DB0101 is the A/R Master that
contains names and addresses. The intent of the introduction of the PROPER
function is to include a column of cells that contain the name in mixed case
(where initially the name is stored in all capital letters).
     H DEBUG DFTNAME(BA0215) OPTION(*NODEBUGIO) DFTACTGRP(*NO)
BNDDIR('HSSF')
     H  THREAD(*SERIALIZE)
      *--------------------------------------------------------------------*
      *--------------------------------------------------------------------*
      *   USE THE FOLLOWING COMMAND TO CREATE THIS PROGRAM:             
      *   CRTBNDRPG PGM(PRDEXC/BA0215) SRCFILE(PRDSRC/QRPGLESRC)     
      *     DFTACTGRP(*NO) ACTGRP(HFFSR4)                             
      *--------------------------------------------------------------------*
      *
     FDB0101L   IF   E           K DISK
      *
     D POS1            S              5U 0
     D POS2            S              5U 0
     D NUM1            S              5U 0
     D NUM2            S              5U 0
     D Row#            S              5I 0
      *
     D TabNam          S             31A   VARYING
     D Str             S                   LIKE(jString)
     D Str2            S                   LIKE(jString)
     D Str3            S                   LIKE(jString)
     D Book            S                   LIKE(HSSFWorkbook)
     D Sheet           S                   LIKE(HSSFSheet)
     D row             S                   LIKE(HSSFRow)
     D cell            S                   LIKE(HSSFCell)
     D outfile         S                   LIKE(jFileOutputStream)
     D Left            S                   LIKE(HSSFCellStyle)
     D valueChr        S           1024A
     D Rlacct          S             16A
     D Rlfrnm          S             25A
     D Rllsnm          S             25A
     D Rladdr          S             28A
     D Rlcity          S             13A
     D Rlstat          S              2A
     D Rlzipc          S              5A
     D Rlactd          S             10A
      *
     D SPRTAB          C                   CONST('SPREADSHEET TAB NAME')
     D Apos            C                   CONST(x'7D')
      *
     D*COPY QSYSINC/QRPGLESRC,JNI
     D/COPY QRPGLECPY,HSSF_H
      *
     C     *IN99         DOUEQ     *ON
      *
     C     GETRCD        TAG
      *
     C                   READ      DB0101R                                99
     C     *IN99         CABEQ     *ON           ENDRCD                   LR
      *
     C                   CLEAR                   POS1
     C                   CLEAR                   POS2
     C     SUBNAM        IFNE      *BLANKS
     C                   EVAL      POS1 = %SCAN(',':SUBNAM)
     C                   ENDIF
     C     POS1          IFEQ      0
     C                   EVAL      RLFRNM = SUBNAM
     C                   EVAL      RLLSNM = *BLANKS
     C                   GOTO      PRCADDR
     C                   ENDIF
     C     POS1          IFEQ      25
     C                   EVAL      RLFRNM = *BLANKS
     C                   EVAL      RLLSNM = %SUBST(SUBNAM:1:24)
     C                   GOTO      PRCADDR
     C                   ENDIF
     C                   EVAL      POS2 = POS1 + 1
     C                   EVAL      NUM1 = 26 - POS2
     C                   EVAL      NUM2 = POS1 - 1
     C                   EVAL      RLFRNM = %TRIM(%SUBST(SUBNAM:POS2:NUM1))
     C     NUM2          IFNE      0
     C                   EVAL      RLLSNM = %TRIM(%SUBST(SUBNAM:1:NUM2))
     C                   ELSE
     C                   EVAL      RLLSNM = *BLANKS
     C                   ENDIF
      *
     C     PRCADDR       TAG
      *
      * I have omitted code which would create column headings. The
following code deals with creating from the second row onward.
      *
    /free
        HSSFSheet_setColumnWidth(Sheet:0:16*256);
        Row# = Row# + 1;
        Row = HSSFSheet_createRow(Sheet:Row#);
        Cell = HSSFRow_createCell(Row:0);
        Left = HSSFWorkbook_createCellStyle(Book);
        HSSFCellStyle_setAlignment(Left:ALIGN_LEFT);
        HSSFCell_setCellType(Cell:CELL_TYPE_STRING);
        Str2 = new_String(RLACCT);
        HSSFCell_setCellValueStr(Cell:Str2);
        HSSFCell_setCellStyle(Cell:Left);
                    ...    ...    ...    ...
        HSSFSheet_setColumnWidth(Sheet:14:25*256);
        Cell = HSSFRow_createCell(Row:14);
        HSSFCellStyle_setAlignment(Left:ALIGN_LEFT);
        HSSFCell_setCellType(Cell:CELL_TYPE_FORMULA);
        valueChr = 'PROPER(' + Apos + %TRIM(RLFRNM) + Apos + ')';
        Str2 = new_String(valueChr);
        HSSFCell_setCellFormula(Cell:Str2);
        HSSFCell_setCellStyle(Cell:Left);
        HSSFSheet_setColumnWidth(Sheet:15:25*256);
        Cell = HSSFRow_createCell(Row:15);
        HSSFCellStyle_setAlignment(Left:ALIGN_LEFT);
        HSSFCell_setCellType(Cell:CELL_TYPE_FORMULA);
        valueChr = 'PROPER(' + Apos + %TRIM(RLLSNM) + Apos + ')';
        Str2 = new_String(valueChr);
        HSSFCell_setCellFormula(Cell:Str2);
        HSSFCell_setCellStyle(Cell:Left);
      /end-free
      *
     C     ENDRCD        TAG
The problem occurs on the line which states: "
HSSFCell_setCellFormula(Cell:Str2);". 
Can anyone determine why I get the "Java exception received when calling
Java method." error message and what I need to change to allow the code to
run?
Thanks to anyone who can help.
Wes Palmer
Programmer/Analyst
Stayton Cooperative Telephone Co.
503-769-8456
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: 
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.