Subfiles and pointers - IBM AS400

This is a discussion on Subfiles and pointers - IBM AS400 ; Hi, Is there any way to get a pointer (ie, an address) on a subfile? Thx Jack...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Subfiles and pointers

  1. Subfiles and pointers

    Hi,

    Is there any way to get a pointer (ie, an address) on a subfile?

    Thx

    Jack


  2. Re: Subfiles and pointers


    "Jack" wrote in message
    news:1165676373.648180.212190@79g2000cws.googlegro ups.com...
    > Hi,
    >
    > Is there any way to get a pointer (ie, an address) on a subfile?
    >
    > Thx
    >
    > Jack
    >

    No. The only pointer you would be able to get is a pointer to the record
    buffer.
    Neither can you store pointers in a subfile record. Any pointers you
    attempted to place in a subfile record would be invalidated on the next
    I/O operation.



  3. Re: Subfiles and pointers

    Can you please define "... a pointer to the record buffer".


    What I would like to do would be to grant a Java app. an access to the
    subfile loaded by an existing RPG ILE app; so the Java app. can process
    the data in the subfile.

    Thx

    Tim M wrote:
    > "Jack" wrote in message
    > news:1165676373.648180.212190@79g2000cws.googlegro ups.com...
    > > Hi,
    > >
    > > Is there any way to get a pointer (ie, an address) on a subfile?
    > >
    > > Thx
    > >
    > > Jack
    > >

    > No. The only pointer you would be able to get is a pointer to the record
    > buffer.
    > Neither can you store pointers in a subfile record. Any pointers you
    > attempted to place in a subfile record would be invalidated on the next
    > I/O operation.



  4. Re: Subfiles and pointers


    "Jack" wrote in message
    news:1165684767.966255.66490@79g2000cws.googlegrou ps.com...
    > Can you please define "... a pointer to the record buffer".
    >
    >
    > What I would like to do would be to grant a Java app. an access to the
    > subfile loaded by an existing RPG ILE app; so the Java app. can
    > process
    > the data in the subfile.
    >
    > Thx
    >
    > Tim M wrote:
    >> "Jack" wrote in message
    >> news:1165676373.648180.212190@79g2000cws.googlegro ups.com...
    >> > Hi,
    >> >
    >> > Is there any way to get a pointer (ie, an address) on a subfile?
    >> >
    >> > Thx
    >> >
    >> > Jack
    >> >

    >> No. The only pointer you would be able to get is a pointer to the
    >> record
    >> buffer.
    >> Neither can you store pointers in a subfile record. Any pointers you
    >> attempted to place in a subfile record would be invalidated on the
    >> next
    >> I/O operation.

    >


    1. Java has no ability to manipulate pointers.

    2. When you open a file object, space is allocated for the input and
    output from that file object. When you perform a read operation, data
    from the file is placed in to the record buffer. And vice versa, data
    that is written to the file is taken from the output buffer.

    Your best bet is to write a stored procedure that produces a record set
    that your Java app can open and process



  5. Re: Subfiles and pointers


    Jack wrote:
    > Can you please define "... a pointer to the record buffer".
    >
    >
    > What I would like to do would be to grant a Java app. an access to the
    > subfile loaded by an existing RPG ILE app; so the Java app. can process
    > the data in the subfile.


    you can access subfile records by relative record number ( RRN ). And
    Java, I guess, can call the record i/o C runtime functions ( _ropen,
    _rwrite, ... ) So theoretically the RPG could use ropen to open the
    dspf gettting back the open handle. The RPG then uses other recio
    functions like rformat and rwrited to fill the subfile. Then call the
    Java function with the handle to the open dspf. The Java code uses
    rreadd to read direct from the subfile by RRN.

    what about the RPG using CHAIN by rrn to the subfile to fill an array
    containing the subfile contents. Then call the Java function with that
    array as a parameter?

    -Steve


  6. Re: Subfiles and pointers


    "Steve Richter" wrote in message
    news:1165764974.321868.162890@79g2000cws.googlegro ups.com...
    >
    > Jack wrote:
    >> Can you please define "... a pointer to the record buffer".
    >>
    >>
    >> What I would like to do would be to grant a Java app. an access to
    >> the
    >> subfile loaded by an existing RPG ILE app; so the Java app. can
    >> process
    >> the data in the subfile.

    >
    > you can access subfile records by relative record number ( RRN ). And
    > Java, I guess, can call the record i/o C runtime functions ( _ropen,
    > _rwrite, ... ) So theoretically the RPG could use ropen to open the
    > dspf gettting back the open handle. The RPG then uses other recio
    > functions like rformat and rwrited to fill the subfile. Then call the
    > Java function with the handle to the open dspf. The Java code uses
    > rreadd to read direct from the subfile by RRN.
    >
    > what about the RPG using CHAIN by rrn to the subfile to fill an array
    > containing the subfile contents. Then call the Java function with that
    > array as a parameter?
    >
    > -Steve
    >


    Won't work. display file I/O is not thread safe but java requires a
    multi-thread capable job. The java would have to run in another process,
    but the open file handle is only valid in the job that opened it.



  7. Re: Subfiles and pointers


    Tim M wrote:
    > "Steve Richter" wrote in message
    > news:1165764974.321868.162890@79g2000cws.googlegro ups.com...
    > >
    > > Jack wrote:
    > >> Can you please define "... a pointer to the record buffer".
    > >>
    > >>
    > >> What I would like to do would be to grant a Java app. an access to
    > >> the
    > >> subfile loaded by an existing RPG ILE app; so the Java app. can
    > >> process
    > >> the data in the subfile.

    > >
    > > you can access subfile records by relative record number ( RRN ). And
    > > Java, I guess, can call the record i/o C runtime functions ( _ropen,
    > > _rwrite, ... ) So theoretically the RPG could use ropen to open the
    > > dspf gettting back the open handle. The RPG then uses other recio
    > > functions like rformat and rwrited to fill the subfile. Then call the
    > > Java function with the handle to the open dspf. The Java code uses
    > > rreadd to read direct from the subfile by RRN.
    > >
    > > what about the RPG using CHAIN by rrn to the subfile to fill an array
    > > containing the subfile contents. Then call the Java function with that
    > > array as a parameter?
    > >
    > > -Steve
    > >

    >
    > Won't work. display file I/O is not thread safe but java requires a
    > multi-thread capable job. The java would have to run in another process,
    > but the open file handle is only valid in the job that opened it.


    How would the non threadsafeness be a problem? The recio functions used
    to access the subfile would never be called from multiple threads. I
    dont know Java - can Java be called from an RPG module that is running
    in the interactive subsystem?

    -Steve


  8. Re: Subfiles and pointers


    "Steve Richter" wrote in message
    news:1165845339.976063.8870@16g2000cwy.googlegroup s.com...
    >
    > Tim M wrote:
    >> "Steve Richter" wrote in message
    >> news:1165764974.321868.162890@79g2000cws.googlegro ups.com...
    >> >
    >> > Jack wrote:
    >> >> Can you please define "... a pointer to the record buffer".
    >> >>
    >> >>
    >> >> What I would like to do would be to grant a Java app. an access to
    >> >> the
    >> >> subfile loaded by an existing RPG ILE app; so the Java app. can
    >> >> process
    >> >> the data in the subfile.
    >> >
    >> > you can access subfile records by relative record number ( RRN ).
    >> > And
    >> > Java, I guess, can call the record i/o C runtime functions (
    >> > _ropen,
    >> > _rwrite, ... ) So theoretically the RPG could use ropen to open
    >> > the
    >> > dspf gettting back the open handle. The RPG then uses other recio
    >> > functions like rformat and rwrited to fill the subfile. Then call
    >> > the
    >> > Java function with the handle to the open dspf. The Java code uses
    >> > rreadd to read direct from the subfile by RRN.
    >> >
    >> > what about the RPG using CHAIN by rrn to the subfile to fill an
    >> > array
    >> > containing the subfile contents. Then call the Java function with
    >> > that
    >> > array as a parameter?
    >> >
    >> > -Steve
    >> >

    >>
    >> Won't work. display file I/O is not thread safe but java requires a
    >> multi-thread capable job. The java would have to run in another
    >> process,
    >> but the open file handle is only valid in the job that opened it.

    >
    > How would the non threadsafeness be a problem? The recio functions
    > used
    > to access the subfile would never be called from multiple threads. I
    > dont know Java - can Java be called from an RPG module that is running
    > in the interactive subsystem?
    >

    you can't open display files from multi-thread capable jobs. but java
    classes must run inside a multi-thread capable job. You can spawn the
    java to another processs using QSH or the RUNJAVA command but then you
    won't be able to share the C file descriptor.



+ Reply to Thread