Thanks, I missed that it passes back an unused object, but now that you say that, I see it in the Java docs.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----broehmer@xxxxxxxxxxxxxxx wrote: ----- 
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: broehmer@xxxxxxxxxxxxxxx
Date: 02/25/2016 04:48PM
Subject: Re: Update Excel with RPG
For anyone who was following this thread, the following will
correctly provide all the required entries in hssf_h:
D AUTOFILTER_CLASS... 
D                 c                   'org.apache.poi.ss.usermodel- 
D                                     .AutoFilter' 
D SSAutoFilter... 
D                 S               O   CLASS(*JAVA 
D                                     : AUTOFILTER_CLASS) 
D ssSheet_setAutoFilter... 
D                 PR                  like(SSAutoFilter) 
D                                     EXTPROC(*JAVA: SHEET_CLASS 
D                                     :'setAutoFilter') 
D ref                                 like(CellRangeAddress)  const 
 
In the rpg program references as an example:
 range = new_cellRangeAddress(0:10:0:4); 
 ssSheet_setAutoFilter(sheet:range); 
The missing piece was provided by a gentleman in England
who figured out that the ssSheet_setAutoFilter needed a reference back
to SSAutofilter using the "like(SSAutoFilter)" as shown. 
Bill 
"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments 
accompanying it) contain confidential information belonging to the sender. 
 The information is intended only for the use of the intended recipient. 
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance 
on the contents of the information is strictly prohibited.  Any 
unauthorized interception of this transmission is illegal under the law. 
If you have received this transmission in error, please promptly notify 
the sender by reply e-mail, and then destroy all copies of the 
transmission."
From:   "Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
To:     Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date:   02/25/2016 07:36 AM
Subject:        Re: Update Excel with RPG
Sent by:        "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
Well as you know ILE programs do not have to be homogenous as far as the 
language goes. The procedure START_JVM is in Scott's HSSFR4 service 
program, but I am calling it from my CLLE program STARTUPJVM. I use a 
binding directory to provide the reference. It appears that I had to go 
into the HSSFR4 source and put Export on the start_jvm procedure. I also 
had to move the prototype for that procedure from hssfr4 to hssf_h (but 
not to call it from my CLLP program). Then you should be able to make the 
startupjvm program compile.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----broehmer@xxxxxxxxxxxxxxx wrote: ----- 
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: broehmer@xxxxxxxxxxxxxxx
Date: 02/23/2016 12:29PM
Subject: Re: Update Excel with RPG
Mark,
Yes you are right about the typo.  Range is defined correctly.
I'm actually using 3.12.  However when I change my
CLLE to include the java_home to go to 626 and then run
java -version I get: 
Directory /QOPENSYS/QIBM/PRODDATA/JAVAVM/JDK626/32BIT in 
JAVA_HOME environment variable not found.
So I know that I've got something amiss/different from yours.  (And yes
the above directory is there.) 
Since you have a binding directory involved at the CLLE level, I'd be 
interested in how
you implemented the START_JVM.  Not something I had considered. Not
sure it will make a difference but I'd like to run that down.  That's 
pretty
interesting. 
"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments 
accompanying it) contain confidential information belonging to the sender. 
 The information is intended only for the use of the intended recipient. 
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance 
on the contents of the information is strictly prohibited.  Any 
unauthorized interception of this transmission is illegal under the law. 
If you have received this transmission in error, please promptly notify 
the sender by reply e-mail, and then destroy all copies of the 
transmission."
From:   "Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
To:     Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date:   02/23/2016 07:27 AM
Subject:        Re: Update Excel with RPG
Sent by:        "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
No, I'm using Java 6.
The Range should be defined as:
d range   ...   Like(CellRangeAddress);
But that may be a typo on your part since using RangeAddress vs. 
CellRangeAddress would likely cause it to fail compile.
If I am sure of my definitions, I usually look at my JVM and environment 
variables. If something gets hosed, you have to sign off, then sign back 
on since you only get a single JVM per job and once it is corrupted you 
need a new job to get a new JVM. I created a CL to start my JVM so I could 
manage it manually, but eventually once I got things stable, I just put it 
into my initial program.  Here is my SETUPJVM CLP.
PGM
DCLPRCOPT DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR(JCS)
DCL       VAR(&POINTER) TYPE(*PTR)
ADDENVVAR ENVVAR(CLASSPATH) +
            VALUE('+
              /java/poi-3.13/poi-3.13-20150929.jar:+
              /java/poi-3.13/poi-ooxml-3.13-20150929.jar:+
              /java/poi-3.13/poi-ooxml-schemas-3.13-20150929.jar:+
              /java/poi-3.13/lib/commons-codec-1.9.jar:+
              /java/poi-3.13/lib/commons-logging-1.1.3.jar:+
              /java/poi-3.13/lib/log4j-1.2.17.jar:+
              /java/poi-3.13/ooxml-lib/xmlbeans-2.6.0.jar:+
              /java/poix/poi-extend-dev.jar:+
              /java/xlparse36/xlparse.jar:+
              /java/javamail/javax.mail.jar:+
              /java/rpgmail/rpgmail.jar:+
              /java/prod/lib/mxSqlSvrJdbc.jar:+
              /java/prod/lib/sqljdbc.jar:+
              /java/prod/classes/cribMaster+
            ') LEVEL(*JOB) REPLACE(*YES)
ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) +
            VALUE('+
              -Djava.awt.headless=true;+
              -Dos400.awt.native=true;+
            ') REPLACE(*YES)
ADDENVVAR ENVVAR(JAVA_HOME) +
            VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk626/32bit'+
            ) REPLACE(*YES)
CALLPRC PRC(START_JVM) RTNVAL(&POINTER)
out: ENDPGM
Note that procdure call to START_JVM which resides in HSSFR4. Also there 
are some classes not found in POI since you only get one shot to declare 
your classpath, and if that is wrong when you start your JVM, you need to 
log off and log back on to get a new JVM. Unfortunately I have not found a 
way to discover your current classpath, because it might not be what is in 
the environment variable. Note, the environment variable can be changed, 
but the class path is based on the value of the environment variable (or 
maybe a command line option if you use runjava) at the time the jvm is 
started. But if you use this simple setupjvm clp, then you know what it 
is. Another advantage of a cl like this is you can call it in a batch 
stream to set up the JVM for that job, and you know it is correct. Note, 
this is my development clp, the production one uses POI 3.12.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----broehmer@xxxxxxxxxxxxxxx wrote: ----- 
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: broehmer@xxxxxxxxxxxxxxx
Date: 02/22/2016 10:49AM
Subject: Re: Update Excel with RPG
Mark,
I'm back on my setAutoFilter problem. 
After playing with different versions
including 3.7,3.11,3.12 I still have a problem
with the setAutoFilter showing up as an 
invalid method.  I got past the class not being
defined but now the error is:
"received Java exception "java.lang.NoSuchMethodError: 
org/apache/poi/ss/usermodel/Sheet.setAutoFilter(Lorg/apache/poi/ss/util"
when calling method "setAutoFilter" with signature 
"(Lorg.apache.poi.ss.util.CellRangeAddress;)V" in class 
"org.apache.poi.ss.usermodel.Sheet".
The range is defined as D range  ...  like(RangeAddress)
The code is:
range = new_cellRangeAddress(0:100:0:4); 
ssSheet_setAutoFilter(sheet:range); 
 hssf_h has been changed to include the setautofilter:
D SSSheet_setAutoFilter... 
D                 PR                  EXTPROC(*JAVA: SHEET_CLASS 
D                                     :'setAutoFilter') 
D ref                                 like(CellRangeAddress) const 
In your example you indicate that you are on 7.1.
So my question is a simple one:  Do you think this would
have anything to do with my being on version 6.1 with java 6.0
instead of java 7?
Any help would be most appreciated. 
Bill 
"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments 
accompanying it) contain confidential information belonging to the sender. 
 The information is intended only for the use of the intended recipient. 
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance 
on the contents of the information is strictly prohibited.  Any 
unauthorized interception of this transmission is illegal under the law. 
If you have received this transmission in error, please promptly notify 
the sender by reply e-mail, and then destroy all copies of the 
transmission."
From:   "Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
To:     Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date:   02/18/2016 07:49 AM
Subject:        Re: Update Excel with RPG
Sent by:        "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
First, you are correct about the call to new_cellRangeAddress(0,10,0,5); 
should use : instead of , to separate parameters.
Second, to enable this, you only need to modify hssf_h.
Third, what is the error message, I am unsure what your problem is. Is 
setAutoFilter not found in org.apache.poi.ss.usermodel.Sheet? 
Do you have range declared as a Java Object?
     dcl-s range  Like(CellRangeAddress);
What does you code look like?
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----broehmer@xxxxxxxxxxxxxxx wrote: ----- 
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: broehmer@xxxxxxxxxxxxxxx
Date: 02/17/2016 03:33PM
Subject: Update Excel with RPG
POI does it starting with version 3.7, here is a Java example:
Workbook wb = new HSSFWorkbook(); //or new XSSFWorkbook();
Sheet sheet = wb.createSheet();
sheet.setAutoFilter(new CellRangeAddress(0,100,0,10));
Now, Scott's HSSF prototypes do not include the setAutoFilter method, 
but that can be added
// ----------------------------------------------------------------
// ssSheet_setAutoFilter()
//
// sets an auto filter for a range of cells
// ref - a range to set the filter on
// ----------------------------------------------------------------
dcl-pr ssSheet_setAutoFilter 
ExtProc(*JAVA
: SHEET_CLASS
: 'setAutoFilter');
ref Like(CellRangeAddress) const;
end-pr;
Call in RPG using HSSF this way to set auto filter on the first ten rows 
and first five columns:
wb = new_XSSFWorkbook();
sheet = ss_newSheet(wb: 'Sheet1');
range = new_cellRangeAddress(0,10,0,5);
ssSheet_setAutoFilter(sheet: range);
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx 
Back in December Mark Murphy injected the above as a modification to
Scott's HSSF_h.
I'm wondering if Mark would elaborate on what he did. 
I tried to add this addition to HSSF_h (using POI-3.11) and I'm not sure 
what I'm missing
as far as modifications go because while compiling a program it says the 
setAutoFilter 
is not defined.
Also, I'm concerned that what's shown  ...Address(0,10,0,5) probably 
should be (0:10:0:5) 
at least in the rpg code.  Should there be entries in HSSF_h as well as 
HSSF4? 
D SSSheet_setAutoFilter... 
D                 PR                    EXTPROC(*JAVA: SHEET_CLASS 
D                                     :'setAutoFilter') 
D ref                                 like(CellRangeAddress) const 
 
Thanks!
Bill 
"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments 
accompanying it) contain confidential information belonging to the sender. 
 The information is intended only for the use of the intended recipient. 
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance 
on the contents of the information is strictly prohibited.  Any 
unauthorized interception of this transmission is illegal under the law. 
If you have received this transmission in error, please promptly notify 
the sender by reply e-mail, and then destroy all copies of the 
transmission."
"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments 
accompanying it) contain confidential information belonging to the sender. 
 The information is intended only for the use of the intended recipient. 
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution or the taking of any action in reliance 
on the contents of the information is strictly prohibited.  Any 
unauthorized interception of this transmission is illegal under the law. 
If you have received this transmission in error, please promptly notify 
the sender by reply e-mail, and then destroy all copies of the 
transmission."
As an Amazon Associate we earn from qualifying purchases.