ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FREE In RPG III

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

  • FREE In RPG III

    It's a simple question to all you guys.. please help..
    I have converted from RPG III to RPG IV, and the result when I compiled there was an error. in this syntax :
    C CALL 'CFD999'
    C PARM DTEFMT 1 0
    C PARM LOCCDP 1 0
    C FREE 'CFD999'

    it's there syntax to replace the "FREE" to RPG IV, please help.


    Thank you

  • #2
    Re: FREE In RPG III

    Done I think, i've got the answer, by calling the CL command, RCLRSC. Please correct me if I'm wrong. Thank you

    Comment


    • #3
      Re: FREE In RPG III

      Hi,

      FREE does not exist in RPGIV and RCLRSC may result in unexpected errors.

      If you want something comparable with the RPGIII Free Opcode, you need to compile your (called) program with either a named activation group or with activation group *NEW.

      With activation group *NEW the programm gets "freeed" immediately after it gets terminated without any additional actions.

      With a named activation group, you need to close this activation group by executing the CL command RCLACTGRP.

      Birgitta

      Comment


      • #4
        Re: FREE In RPG III

        Ohh ic, so i just have to compiled the call program in my code (CFD999) with the DFTACTGRP(*NO) ACTGRP(*NEW)? I still a little confuse about the free or rclrsc, can explain me.. what is/are being "Freed" when we use the "FREE" in RPG III or RCLRSC in RPG IV?

        thank you

        Comment


        • #5
          Re: FREE In RPG III

          Hi,

          Use Eval *INLR = *ON in CFD999.
          *InLR will close or clear all opened files and allocated memory.

          Thanks
          R Babu

          Comment


          • #6
            Re: FREE In RPG III

            You could also try reading this
            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: FREE In RPG III

              @Babu

              *INLR will only release memory in RPGIII.

              In RPGIV *INLR works differently, that means the opened files get closed, but the allocated memory will not be released. The allocated mempory will only be relased by reclaiming the appropriate activation group.

              Birgitta

              Comment


              • #8
                Re: FREE In RPG III

                Originally posted by B.Hauser View Post

                In RPGIV *INLR works differently, that means the opened files get closed, but the allocated memory will not be released. The allocated mempory will only be relased by reclaiming the appropriate activation group.

                Birgitta



                Hi Birgitta,

                I have been use to turn on the *Inlr indicator earlier - as a First line and end the program with return opcod. But It’s not close the files (not need to open for access). No idea about pros and cons, as well as NO cycle anymore. Please point me correct path!

                Code:
                 /free
                
                   *Inlr = *on;
                    // My codes goes here - [B]Read File [/B]& bla bla bla
                   return;
                
                 /end-free
                Thanks
                dhanuxp
                Last edited by dhanuxp; December 22, 2008, 11:46 PM.

                Comment


                • #9
                  Re: FREE In RPG III

                  *inlr can be set on any point in the program, it's when the program ends (i.e. return) that the cycle actually closes the files, etc. prior to v6.1 there is no true way to have a cycle free program. are the files being overridden to share(*yes)? are the files opened in a program higher up in the call stack? i'd check there first. i've never heard of or seen the behavior you are describing...
                  I'm not anti-social, I just don't like people -Tommy Holden

                  Comment


                  • #10
                    Re: FREE In RPG III

                    I've shared with my friend about this, I think i will use what birgitta has told me, but it seems that when compiling with the *NEW, it will make the system with more loads on memory, because the programs is called frequently.. it is right or any other suggestion? (hikkss what am I, 5 years in RPG still a newbie . ) please help, thx u

                    Comment


                    • #11
                      Re: FREE In RPG III

                      If the program is frequently called you could turn it up into a procedure in a service program to get rid of the hassle of activation group and *inlr stuff. The service program should then be compiled using plain ACTGRP(*Caller).
                      Philippe

                      Comment

                      Working...
                      X