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



"Peter Dow (ML)" wrote:
...
I have noticed that if I don't do the strdbg/enddbg, but simply call the
program again after the error has occurred, it works fine.  Which makes
it sound like something in the JVM gets initialized after the first
call, so that it works the 2nd time.


Peter, this bit of the system's Java documentation:   
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzaha/invapiex.htm
mentions that three file descriptors should be opened in the job for
Java I/O to work when the JVM is started by the invocation API (which is
how RPG starts the JVM).  It shows some sample C code that opens the
three descriptors.  An RPG version of this code is below; you may notice
that the C version allocates to /dev/null1, null2 and null3.  Apparently
that is not correct; it should be /dev/null as the RPG version does.

It is not really necessary (and maybe not advisable, I'm not sure) to
close the file descriptors since they will be closed when the job ends,
but the program can be called with parameter 'N' if you want to close
the files after the Java has completed.
   
      * Program ALLOCSTDIO - allocate file descriptors for Java IO
      *
      * Call with no parameters or parameter 'Y' to open the files
      * Call with parameter 'N' to close the files.
     H dftactgrp(*no) bnddir('QC2LE') actgrp(*CALLER)
     D FILE_NOT_OPEN   c                   -1
     D fd              s             10i 0 inz(FILE_NOT_OPEN) dim(3)
     D i               s             10i 0

     D O_CREAT         C                   x'00000008'
     D O_TRUNC         C                   x'00000040'
     D O_WRONLY        C                   x'00000002'
     D O_RDWR          C                   x'00000004'

     D S_IRUSR         C                   x'0100'
     D S_IROTH         C                   x'0004'
     D S_IWUSR         C                   x'0080'
     D S_IWOTH         C                   x'0002'

     D open            pr            10i 0 extproc('open')
     D   filename                      *   value options(*string)
     D   mode                        10i 0 value
     D   aut                         10i 0 value
     D   fileCcsid                   10i 0 value options(*nopass)
     D   dataCcsid                   10i 0 value options(*nopass)
     D closeFile       pr            10i 0 extproc('close')
     D   handle                      10i 0 value

     D allocStdio      pr                  extpgm('ALLOCSTDIO')
     D   closeParm                    1a   const
     D allocStdio      pi
     D   closeParm                    1a   const
      /free
        if  %parms > 0
        and (closeParm = 'n' or closeParm = 'N');
          // close files?
          for i = 1 to 3;
            closeFile(fd(i));
            fd(i) = FILE_NOT_OPEN;
          endfor;
        else;
          // open files if they are not already open
          for i = 1 to 3;
            if fd(i) = FILE_NOT_OPEN;
              fd(i) = open('/dev/null'
                          : 0 + O_CREAT + O_TRUNC + O_RDWR
                          : 0 + S_IRUSR + S_IROTH);
            endif;
          endfor;
        endif;
        return; // lr off
      /end-free


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.