sponsored links

Collapse

Announcement

Collapse
No announcement yet.

COBOL ILE - calling rpg pgm getting error CPF5184

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • COBOL ILE - calling rpg pgm getting error CPF5184

    So I have a COBOL ILE pgm that we just modified to call an existing rpg pgm that we have used for many years. It is simply a pgm to build a subfile for selection in a popup window for the user.

    When the rpg is called from the CBLLE, we are getting the following error.

    Get option not valid for member SRVCDD.
    I/O error CPF5184 was detected in file SRVCDD.
    Function check. RNX1299 unmonitored by SRVLISTR at statement 0000082700,
    instruction X'0000'.
    I/O error CPF5184 was detected in file SRVCDD (C G D F).
    I/O error CPF5184 was detected in file SRVCDD (C G D F).

    Important things to know.

    - SRVCDD usropn
    - file is getting opened
    - pgm is successfully reading 7 records from SRVCDD - on the 7th record it does a "look ahead" routine and reads an 8th record. Then returns to normal processing and does a READP to get back to where it was. This is where it blows up.

    From IBM site -

    >>Cannot complete READ PRIOR because records are left in block from READ NEXT, or vice versa. CPF5184.
    >>Close the file, then open it again.

    Of course closing file and reopening at this point in the processing is not practical.

    What is going on here? what is the solution?

    Important to know, when this rpg pgm is run from command line, it works fine.

    call stack at time of error...

    ------Activation Group------ Control
    Program Name Number Boundary
    LSMSCMNUST LSAMSP3X *DFTACTGRP 0000000000000002 No
    MAIN LSAMSP3X *DFTACTGRP 0000000000000002 No
    NEWLNS LSAMSR3X *DFTACTGRP 0000000000000002 No
    NLS901 LSAMSR3X *DFTACTGRP 0000000000000002 No
    NLS901C LSAMSR3X *DFTACTGRP 0000000000000002 No
    NLS008C LSAMSD3X *DFTACTGRP 0000000000000002 Yes
    NLS008C LSAMSD3X *DFTACTGRP 0000000000000002 No
    SRVLISTR LSAMSD3X *DFTACTGRP 0000000000000002 No
    SRVLISTR LSAMSD3X *DFTACTGRP 0000000000000002 No
    QRNXIE QSYS *DFTACTGRP 0000000000000002 No


    file... (also in *DFTACTGRP)

    Member/ Record File I/O ----Open--- Relative
    File Library Device Format Type Count Opt Shr-Nbr Record
    SRVCDD LDATAD3X SRVCDD RSRVCDD PHY 8 I YES 2 4986



    Last edited by jayvaughn; April 27th, 2017, 08:49 AM.

  • #2
    The CPF5184 seems to indicate a logic error or an OVRDBF may be necessary. If the file is USROPN in the RPG program - is it possible its doing an OPNQRYF before opening the file? Looks like a logic bug in RPG but I don't understand why calling it from a command line works differently unless the environment is somehow different.

    Comment


    • #3
      thanks Terry - yes my initial digging pointed to opnqryf and ovrdbf - none of that applies here - i put in a nasty working solution - i replaced the READP with a CHAIN (from saved key value) and it works. Definitely doesn't explain nor address the initial issue. Would still love to hear the explanation to it.

      Comment


      • #4
        I'm not a Cobol guy, but... is it possible that the Cobol program is opening the file for write only or read only or something like that? Then when the RPG program tries to open it, it's ending up using the same instance of the file as the Cobol program, so it is also locked to input-only or output-only, etc? That would explain why it works properly when the RPG program is called directly, but not when called from within the Cobol program.

        Comment


        • #5
          i'm a cobol guy as of 58 days ago in the new job. Scott, that is one of the things I double checked. It is indeed declared as input only in the cobol pgm. I did post back that i put an ugly working solution on it by replacing the READP with a CHAIN (with a saved key) and that actually works. The mystery continues... I may need to get in touch with that dude at IBM that worked exclusively on the READP opcode for this one.

          Comment


          • #6
            Can you clarify: Is file SRVCDD used anywhere outside of the RPG program in this job?
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              yes - it is declared for input only in the cobol pgm that calls this rpg pgm

              Comment


              • #8
                In that case, what is the COBOL SELECT for that file? E.g., is it declared as ORGANIZATION SEQUENTIAL or INDEXED? And its ACCESS type?
                Tom

                There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                Comment


                • #9
                  Select setting-file
                  assign to database-srvcdd
                  organization is indexed
                  access is dynamic
                  record key is externally-described-key
                  file status is file-status.

                  Comment


                  • #10
                    Originally posted by jayvaughn View Post
                    ...my initial digging pointed to opnqryf and ovrdbf - none of that applies here...
                    I went back to check thread details. When I first read the posts, I must have misunderstood this to mean that OVRDBF didn't apply. But now I see this from your first post:
                    File Library Device Format Type Count Opt Shr-Nbr Record
                    SRVCDD LDATAD3X SRVCDD RSRVCDD PHY 8 I YES 2 4986
                    The file is opened as SHARE(*YES). Is that an attribute of the file or from an OVRDBF in the job? If it's from an OVRDBF, what is the full command?
                    Tom

                    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                    Comment


                    • #11
                      Tom, it is an attribute of the PF.

                      Comment


                      • #12
                        I don't recall ever trying to share between COBOL and RPG. I wouldn't normally expect it to make a difference. Still, I haven't had to look into it in depth before, and I wasn't expecting anything specific. But the ILE COBOL Programmer's Guide has this in the Processing Indexed Files topic.
                        To write Standard COBOL programs that access an indexed file, you must create the file with certain characteristics. Table 31 lists these characteristics and what controls them.

                        And Table 31 has:
                        Characteristic: The file cannot be a shared file.
                        Control: Specify SHARE(*NO) on the CRTPF CL command.

                        It may require OVRDBF SHARE(*NO) before the RPG runs. Perhaps a module that's in its own AG and that does OVRDBF and calls the RPG (running in *CALLER) would do it.

                        Beyond that, an IBMer strong in COBOL might be needed.
                        Tom

                        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                        Comment

                        sponsored links

                        Collapse

                        Working...
                        X