Rocket U2 | UniVerse & UniData

 View Only
  • 1.  Subroutine selection when called from a test program

    Posted 03-08-2024 15:47

    I am trying to confirm how U2 handles this inherently:

    • 1st run a program from my own MY.BP  ex: "RUN MY.BP TEST.PGM" 
    • TEST.PGM calls a subroutine, ex: TEST.SUB(arg1),  that exists in both the account's BP (cataloged in VOC) and a special version in MY.BP.O
      1. will U2 first look at the VOC to execute the subroutine and then, if not found, look in MY.BP (where the original pgm was run from)
      2. will U2 1st try to run the MY.BP version, and if not found, run the one cataloged in the VOC
      3. or, must I name my version to be unique, ex: call TEST.BP.NELSON(arg1), to have it run my version

    We often have a group of programs and subroutines that handle a process, and we are making changes to some of the subroutines, but not all.  Understanding the U2 rules of engagement would really help.

    Nelson



      ------------------------------
      Nelson Schroth
      president
      C3CompleteShop LLC
      Harrison OH US
      ------------------------------


    • 2.  RE: Subroutine selection when called from a test program

      ROCKETEER
      Posted 03-08-2024 16:05

      UniVerse will look for a VOC entry matching the subroutine name before looking in the object file. I'm not sure how UniData works. 

      If the subroutine is a globally cataloged (i.e. begins with "*", "-","!", etc.), then the subroutine is only looked up in the system catalog space. The VOC or object file are not checked.



      ------------------------------
      Neil Morris
      Universe Advanced Technical Support
      Rocket Software
      ------------------------------



    • 3.  RE: Subroutine selection when called from a test program

      Posted 03-09-2024 19:39

      Nelson,

      I've been burmed by this - when someone removes a catalogued entry whoch they think is not eamted any more and the order of precedence means that it does not fail on invocation - it just runs a different program.causing a hidden failure. The same can happen if a program of teh same name is catalogued - possibly elsewhere - that sits in a higher order of precedence and hijacks the code you thought was being used.

      As a suggestion, rather than having multiple versions of programs with the same name - whihc can be confusing at best -  have an array of subroutine names and use CALL @var to call specific individually named subroutine programs - and only have ONE version of any named program or subroutine catalogued in individual accounts.  You could also use a control flag to determine whether live or test program names are used as also illustrated below by a named common flag. - e.g.

      COMMON /MODE/ RUNTIME.MODE

      DIM S.SUBROUTINES(200)

      MAT S,SUBROUTINES=''

      EQU S.CUST.SUBR TO S.SUBROUTINES(1), S.PAYROLL.CALC.SUBR TO S.SUBROUTINES(20, etc.....

      OPEN '',RUN.MODE;'SYSTEM.PARAMS' to F.PARAMS ELSE STOP 'CANNOT OPEN F.PARAMS'

      MATREAD S,SUBROUTINES FROM F.PARAMS,'SYSTEM.SUBROUTINES'  ELSE STOP 'CANNOT READ SYSTEM.SUBROUTINES FROM SYSTEM.PARAMS'

      ...

      ...program logic

      ...

      CALL @S.CUST.SUBR(arg1,arg2,arg3...)

      Regards,

      JJ



      ------------------------------
      John Jenkins
      Thame, Oxfordshire
      ------------------------------



    • 4.  RE: Subroutine selection when called from a test program

      Posted 03-10-2024 09:16
      Hi Nelson, John,
      This is why I always fell back to having a test server (or virtual server) or at the very least a separate copy of an account (with all programs cataloged locally) so that whole suites of things can be changed and tested without impacting what's running live. 


      I can't hide the fact  that this is me <g> and I have a product that works just such a way--and where all the bits and pieces changed in the dev/test environment are tracked and can be deployed/revoked easily--but even if you're writing down the things you change on a napkin, having a separate test environment always felt right / safest to me, if it's doable.  I suspect something about this is NOT doable in your environment?



      John's idea of a flag is smart (as are most of John's ideas,) but does still involve renaming and keeping track of what's been renamed. You can build a whole framework like this for a test.mode --I do this for debugging. A bit of infrastructure...



      Regards,

      Susan Joslyn

      SJ+ Systems Associates, Inc.



      ---- On Sat, 09 Mar 2024 16:39:03 -0800 John Jenkins via Rocket Forum <mail@forum.rocketsoftware.com> wrote ---





      Invite your colleagues to join the Rocket Forum and grow our expert network.



      https://community.rocketsoftware.com


      https://community.rocketsoftware.com/forums/forum-home/digestviewer?CommunityKey=dd45d00d-59db-4884-b3eb-2b0647af231b



      http://community.rocketsoftware.com/participate/postmessage?GroupId=49&ListKey=1daf02a1-f0f0-4a5c-a95d-a2b9f11dcf4b
      https://community.rocketsoftware.com/register



      https://community.rocketsoftware.com/discussion/subroutine-selection-when-called-from-a-test-program#bmfac5335d-42ee-4b4d-ba54-018e25bf3745


      https://community.rocketsoftware.com/forums/all-discussions/postreply?MessageKey=fac5335d-42ee-4b4d-ba54-018e25bf3745&ListKey=1daf02a1-f0f0-4a5c-a95d-a2b9f11dcf4b

      mailto:ROCKET_universe_fac5335d-42ee-4b4d-ba54-018e25bf3745@ConnectedCommunity.org?subject=Re: Subroutine selection when called from a test program






      https://community.rocketsoftware.com/network/members/profile?UserKey=c15fa180-b7cc-429c-93e9-17509c3c3b68

      Mar 9, 2024 7:39 PM


      https://community.rocketsoftware.com/network/members/profile?UserKey=c15fa180-b7cc-429c-93e9-17509c3c3b68










      Nelson,



      I've been burmed by this - when someone removes a catalogued entry whoch they think is not eamted any more and the order of precedence means that it does not fail on invocation - it just runs a different program.causing a hidden failure. The same can happen if a program of teh same name is catalogued - possibly elsewhere - that sits in a higher order of precedence and hijacks the code you thought was being used.

      As a suggestion, rather than having multiple versions of programs with the same name - whihc can be confusing at best -  have an array of subroutine names and use CALL @var to call specific individually named subroutine programs - and only have ONE version of any named program or subroutine catalogued in individual accounts.  You could also use a control flag to determine whether live or test program names are used as also illustrated below by a named common flag. - e.g.

      COMMON /MODE/ RUNTIME.MODE

      DIM S.SUBROUTINES(200)

      MAT S,SUBROUTINES=''

      EQU S.CUST.SUBR TO S.SUBROUTINES(1), S.PAYROLL.CALC.SUBR TO S.SUBROUTINES(20, etc.....

      OPEN '',RUN.MODE;'SYSTEM.PARAMS' to F.PARAMS ELSE STOP 'CANNOT OPEN F.PARAMS'

      MATREAD S,SUBROUTINES FROM F.PARAMS,'SYSTEM.SUBROUTINES'  ELSE STOP 'CANNOT READ SYSTEM.SUBROUTINES FROM SYSTEM.PARAMS'

      ...

      ...program logic

      ...

      CALL @S.CUST.SUBR(arg1,arg2,arg3...)



      Regards,



      JJ





      ------------------------------

      John Jenkins

      Thame, Oxfordshire

      ------------------------------









        https://community.rocketsoftware.com/forums/all-discussions/postreply?MessageKey=fac5335d-42ee-4b4d-ba54-018e25bf3745&ListKey=1daf02a1-f0f0-4a5c-a95d-a2b9f11dcf4b   https://community.rocketsoftware.com/discussion/subroutine-selection-when-called-from-a-test-program#bmfac5335d-42ee-4b4d-ba54-018e25bf3745   https://community.rocketsoftware.com/forums/all-discussions/forwardmessages?MessageKey=fac5335d-42ee-4b4d-ba54-018e25bf3745&ListKey=1daf02a1-f0f0-4a5c-a95d-a2b9f11dcf4b   https://community.rocketsoftware.com/discussion/subroutine-selection-when-called-from-a-test-program?MarkAppropriate=fac5335d-42ee-4b4d-ba54-018e25bf3745#bmfac5335d-42ee-4b4d-ba54-018e25bf3745   http://community.rocketsoftware.com/participate/postmessage?GroupId=49&ListKey=1daf02a1-f0f0-4a5c-a95d-a2b9f11dcf4b  





    • 5.  RE: Subroutine selection when called from a test program

      PARTNER
      Posted 03-11-2024 19:17

      I have no experience with UniData so this content might not be helpful if you are using UD.

      The UniVerse search path for subroutines was covered in an earlier thread: Universe behaviour when loading a subroutine.

      For calls from your test program you have 3 options:

      1. As per @Susan Joslyn's suggestion - setup a TEST account that you can customise the VOC entries in
      2. Use @John Jenkins's method of indirect subroutine calls, allowing you to customise which VOC catalog entry to use for each call
      3. Include the test subroutine at the end of your test program so it is a LOCAL subroutine (see the above thread). This is helpful if you can customise your test routine for specific subroutines.


      ------------------------------
      Gregor Scott
      Software Architect
      Pentana Solutions Pty Ltd
      Mount Waverley VIC AU
      ------------------------------