ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

OVRDBF and Activation Groups.

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

  • OVRDBF and Activation Groups.

    Hi every one, my fist postâ?¦

    I have CLLE type program which does OVRDBF to File-To and Open Query File to File-From, than calls RPGLE program which reads File-From and writes to overridden File-To. The problem I have is that RPGLE program does not see Open Query File or Override and writes everything into main member.

    CLLE program created using command:
    CRTBNDCL PGM(xxxLIBR/xxx01CL)
    SRCFILE(xxxLIBR/xxxSRC)
    SRCMBR(xxxx01CL) TEXT(*SRCMBRTXT)
    DFTACTGRP(*NO) ACTGRP(*NEW)

    RPGLE contains from 2 modules and created using command:
    CRTPGM PGM(xxxxLIB/xxxxPGM) MODULE(MODULE1 MODULE2)

    In some other cases I got around by compiling RPGLE using Create Bound RPG Program command and entered in H specs override for activation group:
    [h dftactgrp(*no) actgrp(*caller)] but in this case I cannot use that since module will never compileâ?¦

    I also tried to create CL module which runâ??s Open Query File and bind it into RPGLE program, than in main RPG module open files manually it works this way just fine. But I am just wondering if somehow I can make RPGLE to be in same activation group as calling CLLE so file overrides could be seen.
    Thanks.

  • #2
    Re: OVRDBF and Activation Groups.

    Have you thought about doing the opnqryf inside the RPG program using QCMDEXC.

    set the file to usropn run the SQL and the ovrdbf share(*yes) with QCMDEXC then
    open the file.


    welcome to code400
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: OVRDBF and Activation Groups.

      The reason I was trying to do all the preliminary stuff in CL is because I wanted to be able to call mentioned RPGLE program from different CL programs.

      Comment


      • #4
        Re: OVRDBF and Activation Groups.

        Sorry, I havent used opnqryf in a while....... but cant you do the override database command at different levels?
        like OVRDBF FILE(SOMEFILE) OVRSCOPE(*CALLLVL) SHARE(*YES)

        found this @ ibm
        Code:
        Typical errors when using the Open Query File (OPNQRYF) command
        
        
        Several functions must be correctly specified for the OPNQRYF 
        command and your program to get the correct results. 
        The Display Job (DSPJOB) command is your most useful tool 
        if problems occur. This command supports both the open files 
        option and the file overrides option. You should look at both 
        of these if you are having problems. 
        
        These are the most common problems and how to correct them: 
        
        Shared open data path (ODP). The OPNQRYF command operates through a 
        shared ODP. In order for the file to process correctly, the member 
        must be opened for a shared ODP. If you are having problems, use the open 
        files option on the DSPJOB command to determine if the member is opened and 
        has a shared ODP. 
        
        There are normally two reasons that the file is not open: 
        
        The member to be processed must be SHARE(*YES). Either use an Override with 
        Database File (OVRDBF) command or permanently change the member. 
        The file is closed. You have run the OPNQRYF command with the 
        OPNSCOPE(*ACTGRPDFN) or TYPE(*NORMAL) parameter option from a program that 
        was running in the default activation group at a higher level in the call 
        stack than the program that is getting an error message or that is simply 
        running the Reclaim Resources (RCLRSC) command. This closes the open query 
        file because it was opened from a program at a higher level in the call stack 
        than the program that ran the RCLRSC command. If the open query file was closed, 
        you must run the OPNQRYF command again. Note that when using the OPNQRYF command 
        with the TYPE(*NORMAL) parameter option on releases prior to Version 2 Release 3, 
        the open query file is closed even if it was opened from the same program that 
        reclaims the resources.
         
        Level check. Level checking is normally used because it ensures that your program 
        is running against the same record format that the program was compiled with. 
        If you are experiencing level check problems, it is normally because of one of 
        the following: 
        
        The record format was changed since the program was created. Creating the 
        program again should correct the problem. 
        
        An override is directing the program to an incorrect file. Use the file 
        overrides option on the DSPJOB command to ensure that the overrides are 
        correctly specified. 
        
        The FORMAT parameter is needed but is either not specified or incorrectly 
        specified. When a file is processed with the FORMAT parameter, you must ensure:
         
        The Override with Database File (OVRDBF) command, used with the TOFILE parameter,
        describes the first file on the FILE parameter of the Open Query File (OPNQRYF) 
        command.
         
        The FORMAT parameter identifies the file that contains the format used to create 
        the program.
         
        The FORMAT parameter is used to process a format from a different file 
        (for example, for group processing), but SHARE(*YES) was not requested on the 
        OVRDBF command. 
        
        The file to be processed is at end of file. The normal use of the OPNQRYF command 
        is to process a file sequentially where you can only process the file once. At 
        that point, the position of the file is at the end of the file and you will not 
        receive any records if you attempt to process it again. To process the file again 
        from the start, you must either run the OPNQRYF command again or reposition the file 
        before processing. You can reposition the file by using the Position Database File 
        (POSDBF) command, or through a high-level language program statement.
         
        No records exist. This can be caused when you use the FORMAT keyword, but do not 
        specify the OVRDBF command. 
        
        Syntax errors. The system found an error in the specification of the 
        OPNQRYF command.
         
        Operation not valid. The definition of the query does not include the KEYFLD 
        parameter, but the high-level language program attempts to read the query file 
        using a key field.
         
        Get option not valid. The high-level language program attempted to read a 
        record or set a record position before the current record position, and the 
        query file used either the group by option, the unique key option, or the 
        distinct option on the SQL statement.

        also good article here
        I converted an RPG/400 program to ILE RPG, and now the OPNQRYF in the calling CL program no longer works. Doesn’t OPNQRYF work with ILE? –Tracy I have two interactive inquiries, and each one consists of a CL program that runs OPNQRYF, then calls an RPG program that loads a subfile and displays the results


        jamie
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: OVRDBF and Activation Groups.

          OPNQRY:
          I thought that you needed to hardcode the scope as OVRSCOPE(*JOB) to make sure that all the programs in named activation groups can see it.

          This is definitely a matter of scope though.

          On the same note you can specify
          STRCMTCTL CMTSCOPE(*ACTGRP)
          This command will only commit the file within a specific activation group. If a program in AG1 calls a program in AG2 and they both have the same file open the commit will occur in AG1 or AG2 respectively.

          If you want overrides to work as they do in OPM you need to specify
          OVRDBF MYFILE OVRSCOPE(*CALLLVL) SHARE(*YES) OPNSCOPE(*JOB)
          CALL MYPROGRAM
          DLTOVR MYFILE (OVRSCOPE(*CALLLVL)
          Last edited by kpmac; December 8, 2005, 09:41 AM.
          Predictions are usually difficult, especially about the future. ~Yogi Berra

          Vertical Software Systems
          VSS.biz

          Comment


          • #6
            Re: OVRDBF and Activation Groups.

            Originally posted by jamief

            also good article here
            I converted an RPG/400 program to ILE RPG, and now the OPNQRYF in the calling CL program no longer works. Doesn’t OPNQRYF work with ILE? –Tracy I have two interactive inquiries, and each one consists of a CL program that runs OPNQRYF, then calls an RPG program that loads a subfile and displays the results

            jamie
            Thanks, itâ??s an informative article.
            The author suggested using this way of creating the program:
            I recommend that Tracy consider changing the job in one of two ILE-friendly ways. One is to create modules of the CL and RPG members and bind them together into one program with the Create Program (CRTPGM) command.
            CRTCLMOD MODULE(MYLIB/INQ1C) SRCFILE(MYLIB/QCLSRC)
            CRTRPGMOD MODULE(MYLIB/INQ1R) SRCFILE(MYLIB/QRPGLESRC)
            CRTPGM PGM(MYPGM) MODULE(MYCL MYRPG) ACTGRP(INQ1)
            I like that idea but there is a problem when you are trying to create program it will fail since RPG module has files declared. Compiler will not allow the program to be created with CL is being as entry module.

            Can anyone explain this or maybe I am missing something.

            Comment


            • #7
              Re: OVRDBF and Activation Groups.

              Originally posted by kpmac
              OPNQRY:
              I thought that you needed to hardcode the scope as OVRSCOPE(*JOB) to make sure that all the programs in named activation groups can see it.

              This is definitely a matter of scope though.

              On the same note you can specify
              STRCMTCTL CMTSCOPE(*ACTGRP)
              This command will only commit the file within a specific activation group. If a program in AG1 calls a program in AG2 and they both have the same file open the commit will occur in AG1 or AG2 respectively.

              If you want overrides to work as they do in OPM you need to specify
              OVRDBF MYFILE OVRSCOPE(*CALLLVL) SHARE(*YES) OPNSCOPE(*JOB)
              CALL MYPROGRAM
              DLTOVR MYFILE (OVRSCOPE(*CALLLVL)

              You have read my mind. I my other program I need to use commitment control.
              So I was thinking to design the CL like this:


              CRTJRNRCV JRNRCV(xxxLIB/xxxRCV) TEXT('Journal Receiver')

              CRTJRN JRN(xxxLIB/xxxJRN) +
              JRNRCV(xxxLIB/xxxRCV) TEXT('Journal') AUT(*ALL)

              STRJRNPF FILE(File-From File-To) JRN(xxxJRN)

              STRCMTCTL LCKLVL(*CHG) CMTSCOPE(*JOB) TEXT('Commitment Control')

              OVRDBF FILE(File-To) TOFILE(File-To) MBR(&MEMBER)
              OVRDBF FILE(File-From) SHARE(*YES)

              OPNQRYF FILE((File-From)) OPTION(*INP) +
              QRYSLT(&QRYSLCT) KEYFLD(*NONE) +
              OPNID(*FILE) SEQONLY(*NO) OPTIMIZE(*MINWAIT)

              CALL PGM(Process)

              CLOF OPNID(File-From)
              MONMSG MSGID(CPF0000)
              DLTOVR FILE(*ALL)
              MONMSG MSGID(CPF0000)

              ENDCMTCTL
              ENDJRNPF FILE(File-From File-To) JRN(xxxJRN)
              DLTJRN JRN(xxxJRN)
              DLTJRNRCV JRNRCV(xxxJRR) DLTOPT(*IGNINQMSG)

              This works if RPG program Process is Bound RPG Program but obviously will not work if my RPG is ILE program.

              Do I only change CMTSCOPE parameter on Commitment Control statement, would that be enough.

              Comment


              • #8
                Re: OVRDBF and Activation Groups.

                Yes, if you change the CMTSCOPE of your ILE module to CMTSCOPE(*JOB) it will behave like an OPM program.
                Last edited by kpmac; December 9, 2005, 01:31 PM.
                Predictions are usually difficult, especially about the future. ~Yogi Berra

                Vertical Software Systems
                VSS.biz

                Comment


                • #9
                  Re: OVRDBF and Activation Groups.

                  Good info. Thanks much.

                  Comment

                  Working...
                  X