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



I had a strong suspicion that the error is related to CALLB 'PROC1'.  This
calls the PEP of proc1.  So I tried two things.
1) Compiled PROC1 CRTBNDPGM ACTGRP(*CALLER)
   CALL PROC1 instead of CALLB.

This works as expected.

2) CALLB GETREC instead of PROC1

This doesn't fall over, but it also returns 0 for the sequence number
because of the parameter list mis-match, like so:

PGM
h debug
 * dbgview(*list)

d getrec          pr             6s 0
d  seq_o                         6s 0 options(*nopass)

d seq             s              6s 0

c                   callb     'GETREC'
c                   parm                    seq
c     seq           dsply

c                   eval      seq = getrec
c     seq           dsply

c                   eval      *inlr = *on

PROC1
h debug
 * dbgview(*list)

fqrpglesrc if   e             disk    usropn
f                                     rename(qrpglesrc: src)

d getrec          pr             6s 0
d  seq_o                         6s 0 options(*nopass)

d iseq            s              6s 0

c     *entry        plist
c                   parm                    iseq

c                   eval      iseq = getrec
c     srcseq        dsply
c                   return

p getrec          b                   export
d getrec          pi             6s 0
d   seq_o                        6s 0 options(*nopass)

c                   if        not %open(qrpglesrc)
c                   open      qrpglesrc
c                   endif

c                   read      src
c                   if        %parms > 0
c                   eval      seq_o = srcseq
c                   endif
c                   return    srcseq
p                 e


Please remember that I do not use CALLB, and have literally never even
considered doing a CALLB against the PEP of a RPG procedure.  I always call
the procedure directly.

I thought I read that this was to be a mixed environment: OPM programs doing
a dynamic CALL to PROC1 and ILE programs directly calling the getrec()
function.  If this is the case, where does the CALLB to PROC1 fit in?  Why
not make PROC1 a program and CALL it?

As for the error dealing with the open/closed file, I have to say I am
stumped.  I spun through the RPG Ref and Programmer books and saw no
limitation on doing this.  I did a brief tour of the ILE Concepts but didn't
find anything germane.  I will continue to look, because I think this is an
interesting problem.  I would 'solve' it by CRTRPGMOD and CRTBNDRPG for
PROC1 and doing a CALL PROC1 instead of CALLB PROC1, but that may not fly in
your environment if you have issues with sharing the ODP.  Some of that can
be alleviated with a named AG for PGM and *CALLER for PROC1.
  --buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.