ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Rpgle

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

  • Rpgle

    Hi all,

    Any ideas on how to track whether a program is being opened, and if it is opened I have to increment the counter variable.

    Actually, If the program is opened for first time, the first allocation is done and second time 2nd is done so on.

    So, to keep track how can I do it?

    Please help...


    Thanks
    hsp
    'Coding = Experience'
    hsp

  • #2
    Re: Rpgle

    if you are using ILE then you can specify the STATIC keyword on the counter variable and the value will not be reinitialized on each call...
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Rpgle

      Hi,
      I have declared a dataara, and each time before calling a program, I am setting it to required value and calling a pgm.

      But, again that seetting of value should be automatic, thinking.... any idea's..
      'Coding = Experience'
      hsp

      Comment


      • #4
        Re: Rpgle

        Hi

        C *DTAARA *Define XX 2p 0

        C IN XX

        C Eval J = %SubST(XX : 1:2) (Variable used for tracking purpose)
        C Eval I = J

        C IF %Open(File)
        C Eval J = J + 1
        C Eval XX = (How to write into DTAARA) ??
        C Eval J = I
        C ENDIF

        Any ideas??

        Thanks
        hsp
        'Coding = Experience'
        hsp

        Comment


        • #5
          Re: Rpgle

          all kinds of cool opcodes...

          Code:
          *lock  in (read) 
          
          out  (writes)    
          
          *DTAARA       DEFINE    *LDA          ARCLDA   (defines)
          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


          • #6
            Re: Rpgle

            C *DTAARA DEFINE ALRUN 2 0
            C *LOCK IN ALRUN
            C EVAL J = ALRUN
            C EVAL I = J
            *
            * Resetting the value of J
            C IF J > 10
            C EVAL J = 0
            C ENDIF
            *
            C If %Open(FBPALP10)
            C EVAL J = J + 1
            C CALL 'HW961CL'
            C PARM J
            C EVAL J = I


            C ENDIF

            In Cl i am updating dtaara.

            I got it.

            Thanks
            If any more suggestions pls give(Optimise)

            Thanks
            hsp
            'Coding = Experience'
            hsp

            Comment

            Working...
            X