hexagon logo

External Subroutine question

Hello all,

I will explain what I want to do before asking the question / your help.

I have programs that need to call a subroutine that will have a rev number. Example "Sub_Rev_A.prg"

I have a text file that those programs read and extract the final letter of the name and assign it in a variable with the readline command. So if I have a second sub named "Sub_Rev_B.prg" and the txt file writes B, the B sub will be read instead.

Now the issue I am having is... Those programs will be read only in a read only folder. I noticed that when I start those programs, they search for the sub they had executed in the first run while NOT in read only mode and after that while executing they search for the real version to execute (and execute it correctly).

In the example I gave be4, Main Program is tested with REV A sub, saved and set to read only. It works with Rev A for some time perfectly. Later on, we revise the sub to rev B, change the Txt to B. The program starts, gives an error message that the sub A is not found (we remove the old revisions), procedes to execution, reads the txt, executes sub B. From that point if I reexecute the Main program without closing it runs without error. If I close and reopen it I am getting the same error for Rev A.

No impact on the result of the measurement but each time I am getting an annoying message that I would love to eliminate if possible. Please know that in reality I am talking about hundreds of programs and subs and it is not possible to remove readonly mode each time we revise a sub without performing validation documents etc,

any help is much appreciated! |

PC-Dmis 2017 R2
  • Strange, got some code to share?

    Other than that, make sure to empty/clear the variable that holds the subname to execute BEFORE you read the textfile. Just to make sure that nothing has been "left over" from the first run and then saved and writeprotected. That is the only thing that comes to mind.
  • Strange, got some code to share?

    Other than that, make sure to empty/clear the variable that holds the subname to execute BEFORE you read the textfile. Just to make sure that nothing has been "left over" from the first run and then saved and writeprotected. That is the only thing that comes to mind.


    If I clear the variable I will get a message that rev 0 is not found. This is because when I reference a variable it is always 0 if I have not defined it beforehand. I did try that :S

    The code I am using is this:

    FPTR =FILE/OPEN,\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDMIS\DEA\PRODUCTION\501106682\REV.TXT,READ
    100 =FILE/READLINE,FPTR,{SUBREV}
    FILE/CLOSE,FPTR,KEEP
    ASSIGN/SUBFULLPATH="\\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDMIS\DEA\PRODUCTION\501106682\APS-PDEA-501106682_REV_" +SUBREV +".PRG"
    CSHEADER =CALLSUB/HEADER,SUBFULLPATH:,​


    The errors I am getting are similar to these (the path matches the one in the code, I just don't have the correct Screenshots at the moment but just the testing ones. The error is the same with the correct path though).




    A solution would be to make pcdmis to hide these messages from some kind of admin settings... Is this maybe possible?​​

    Attached Files
  • Whats with the dollarsign in GROUP$ ?
  • Ask my IT admins and the server owners lol Slight smile
  • The $ means it's going to cost a lot of money to fix. Slight smile
  • I think they use address masks so not a real issue there.
  • Well I cannot seem to find a solution to it. If the subroutine is given within a variable assignment, the error will be there. For me this is a limitation of the software and I hope it has been fixed in later versions (2018+) and if not maybe it would be a good idea to be addressed.
  • One thing you could try is to assign that network path to a device letter and then use the device letter instead when calling the sub.

    It's not the best way but maybe worth a try.
  • The $ means its a network folder that is hidden. Windows won't list them. You have to know their name in order to access them.
  • One thing you could try is to assign that network path to a device letter and then use the device letter instead when calling the sub.

    It's not the best way but maybe worth a try.


    No matter what I do the program starts and searches for a sub before actually processing the code and finalizing the sub in the variable. This means that if I have a variable for the path/name of the sub, pcdmis will reach to that, after it has already searched the sub that was previously used with the last execution of the program. Everyone can give a try to that like this:

    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    REV NUM?
    ASSIGN/V1="PATH\PROGRAMNAME_REV_" +C1.INPUT +".PRG"
    CS1 =CALLSUB/nameofsub,V1:,


    Run program giving Rev 1 as an answer. Change the name of the sub to Rev_B. Execute the program. Pcdmis will give an error message, proceeds to reading the V1 and running the SUB REV B. From that point on B will be impeded to its code and thus this will reoccure once per revision. Imagine now that the program is readonly and having this message at every program execution... :S