+ Reply to Thread
Results 1 to 3 of 3

Thread: Opening XLS to read - path name is too long

  1. #1
    bsnuggs76 Guest

    Default Opening XLS to read - path name is too long

    I'm trying to use AIR09_02 as a template to open an XLS file. In my program the stream file name has to be a variable. I looked at the prototype for AirExcel_getWorkbook and defined my input parameter accordingly.

    D #lcstmf s 1024a varying

    The function call looks like this:
    airWorkbook = AirExcel_getWorkbook(#lcstmf);

    I'm getting the following error:
    Message . . . . : Java exception received when calling Java method.Cause . . . . . : RPG procedure AIREXCEL_G in program AIRLIB/SVAIREXCEL received Java exception "java.io.FileNotFoundException: A path name is too long. /adp/1.xls" when calling method "" with signature "(Ljava.lang.StringV" in class "java.io.FileInputStream".

    When I first got this message, I actually thought the real file name was too long...so I renamed it 1.xls to test but I'm still getting the "path name too long" message.

    What am I doing wrong?

  2. #2
    T.Snyder Guest

    Default

    Try using trim around your string buffer. Varying uses the first two bytes for your length. Also, when passing bytes of characters (RPG character Variables) it will use the whole string for your filename; including the spaces.

    This should get you where you're headed:
    airWorkbook = AirExcel_getWorkbook(%trim(#lcstmf));

    %trim is your friend when going back and forth between RPG with Java using strings.
    Last edited by T.Snyder; 10-07-2010 at 12:08 PM. Reason: Clarification on spaces for Character Bytes

  3. #3
    bsnuggs76 Guest

    Default

    That did it. THANKS AGAIN!!

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts