sponsored links

Collapse

Announcement

Collapse
No announcement yet.

**URGENT**Global variable & Service Programs

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

  • **URGENT**Global variable & Service Programs

    Hello

    Need an urgent Help..!!!!

    Consider Program A which is bound to two service programs, say B & C. There is a global variable Z which is exported(defined as EXPORT) from service program B & C and imported(Defined as IMPORT) in program A. The global variable Z is defined in export symbol in both service program's binder language.

    The problem is if I change the value of this global variable Z in Program A, the value is available/reflected in service program B, however the same is not avilable/reflected in service program C.


    I tried defining the global variable Z as IMPORT in service program C. Still it does not work.

    HOW can I make the value of this global variable available in both service programs(the value of Z is changed in program A only) ?? Urgent help PLssssssssssssss.

    Regards, Deep

  • #2
    Personally I would change it to use a User Space and have all routines map to it.

    Export/Import is an ugly capability that many of us involved in the development of ILE wish had never been "born"!

    Beyond that - off the top of my head - I can't think of an easy solution and having lost the whole day due to a waterlogged computer I'm afraid I haven't time to "play".

    Comment


    • #3
      I think it will work if you export it from srvpgm B and import it from srvpgm C. But you also need to create srvpgm B with BNDSRVPGM(srvpgm C).

      Comment


      • #4
        I tend to agree with Jonboy - global variables are just not a good idea. I'd create a routine to pass the information back and forth or put it into LDA or USRSPC.

        Comment


        • #5
          I think LDA is even worse than global variables. LDA is global for the whole job. It makes my brain hurt to imagine keeping track of everything that's using the LDA, and making sure that only one set of programs is using any given section of the LDA.

          A *DTAARA object would be better, since it would be easier to control what's using it. A USRSPC would be ok for the same reason.

          But passing parameters seems the most straightforward to me.

          Comment


          • #6
            Originally posted by Barbara Morris View Post
            I think LDA is even worse than global variables. LDA is global for the whole job. It makes my brain hurt to imagine keeping track of everything that's using the LDA, and making sure that only one set of programs is using any given section of the LDA.

            A *DTAARA object would be better, since it would be easier to control what's using it. A USRSPC would be ok for the same reason.

            But passing parameters seems the most straightforward to me.
            I totally agree with Barbara's concepts here for my interpretation of Deep's original post. Adding a parameter can be much easier to deal within Pgm B and Pgm C than using the LDA or IMPORT/EXPORT processing.. Then again, if Pgm B or Pgm C service programs are used by other programs... then adding the new field to those two service programs could cause conflicts within anything else that uses Pgm B or Pgm C.


            Best Regards and Good Luck!
            Fred Williams

            Comment

            sponsored links

            Collapse

            Working...
            X