Your Products have been synced, click here to refresh
[B]ASSIGN/MYSUBNUM="1"[/B] FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBNUM="SUB"+MYSUBNUM CS1 =CALLSUB/MYSUBNUM,C:\Users\Public\Documents\Hexagon\PC-DMIS\2023.1\SubLibrary.PRG:,
[B]ASSIGN/MYSUBNUM=""[/B] FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBNUM="SUB"+MYSUBNUM CS1 =CALLSUB/MYSUBNUM,C:\Users\Public\Documents\Hexagon\PC-DMIS\2023.1\SubLibrary.PRG:,
I think if you make sure the variable initially holds a valid subname it won't error.
On starting execution it's just running a check that the CALLSUB points to a valid location.
This seems to work for me:
[B]ASSIGN/MYSUBNUM="1"[/B] FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBNUM="SUB"+MYSUBNUM CS1 =CALLSUB/MYSUBNUM,C:\Users\Public\Documents\Hexagon\PC-DMIS\2023.1\SubLibrary.PRG:,
Where as this didn't (and I go t the same error you mention)
[B]ASSIGN/MYSUBNUM=""[/B] FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBNUM="SUB"+MYSUBNUM CS1 =CALLSUB/MYSUBNUM,C:\Users\Public\Documents\Hexagon\PC-DMIS\2023.1\SubLibrary.PRG:,
ASSIGN/MYSUBNUM=1 ASSIGN/MYSUBFILE="C:\\Users\\Public\\Documents\\Hexagon\\PC-DMIS\\2023.1\\SubLibrary" FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBFILE=MYSUBFILE+MYSUBNUM+".prg" CS1 =CALLSUB/MYSUB,MYSUBFILE:,
ASSIGN/SUBREV="A" FPTR =FILE/OPEN,\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDMIS\DEA\PR ODUCTION\501106682\REV.TXT,READ 100 =FILE/READLINE,FPTR,{SUBREV} FILE/CLOSE,FPTR,KEEP ASSIGN/SUBFULLPATH="\\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDM IS\DEA\PRODUCTION\501106682\APS-PDEA-501106682_REV_" +SUBREV +".PRG" CSHEADER =CALLSUB/HEADER,SUBFULLPATH:,
This works (All files are set to ReadOnly in Windows)
ASSIGN/MYSUBNUM=1 ASSIGN/MYSUBFILE="C:\\Users\\Public\\Documents\\Hexagon\\PC-DMIS\\2023.1\\SubLibrary" FPTR =FILE/OPEN,C:\Temp\SubNum.txt,READ V1 =FILE/READLINE,FPTR,{mysubnum} FILE/CLOSE,FPTR,KEEP ASSIGN/MYSUBFILE=MYSUBFILE+MYSUBNUM+".prg" CS1 =CALLSUB/MYSUB,MYSUBFILE:,
I think the key is to initialise MYSUBNUM (or SUBREV in your case) so that the MYSUB file points to a valid .prg before execution
ASSIGN/SUBREV="A" FPTR =FILE/OPEN,\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDMIS\DEA\PR ODUCTION\501106682\REV.TXT,READ 100 =FILE/READLINE,FPTR,{SUBREV} FILE/CLOSE,FPTR,KEEP ASSIGN/SUBFULLPATH="\\\CHLLCM0APPSRV03\GXP_VALIDATED\PCDM IS\DEA\PRODUCTION\501106682\APS-PDEA-501106682_REV_" +SUBREV +".PRG" CSHEADER =CALLSUB/HEADER,SUBFULLPATH:,
ASSIGN/MYSUBNUM=1
You still do not understand what I try to achieve When I revise my subprogram I will need to revise my main program also to change thethat you put in your program. This beats the point of modifying a program only and not all my 1k programs when I want to change something in the header (add a tracefiled) for example.ASSIGN/MYSUBNUM=1
Your method requires modifying the program and the sub program. I want to modify the sub only without touching the mainprogram and logic says that since I am using variables I should be able to do it without error messages which apparently is not the case
I do understand what you're trying to do (I think).
You're not getting what I'm saying.
The line...
ASSIGN/MYSUBNUM=1
.. .doesn't need changing.
All it does is have an initial value that will form a valid file name (i.e. one that exists on the system) and contains a subroutine called (in my example) 'MYSUB'
At execution time, MYSUBNUM becomes whatever is read from the text file (1,2,3 etc) as you up-rev your subroutines.
To clarify.
When you start execution, PC-Dmis is looking at that CALLSUB command, and doing a verification that it exists.
In my case it's looking at the 'MYSUBFILE' assignment. This is made up of MYSUBFILE+MYSUBNUM+".prg"
So it looks what values they currently hold
MYSUBFILE = "C:\\Users\\Public\\Documents\\Hexagon\\PC-DMIS\\2023.1\\SubLibrary"
MYSUBNUM = 1
".prg" = ".prg"
It sticks all those together to get "C:\\Users\\Public\\Documents\\Hexagon\\PC-DMIS\\2023.1\\SubLibrary1.prg" then it checks it contains a subroutine called MYSUB (which it does).
It doesn't matter that it might not actually be the subroutine program we eventually call, just that it's a valid file / subname when it starts.
It's then happy to proceed with execution without displaying an error.
What I am trying to achieve is not possible
Can't you just have a dummy routine which doesn't actually do anything as the initial routine?
ASSIGN/HEADERSUBFILE="C:\TEMP\DUMMY.PRG
Then rather than just have A or B in the text file, have the full path of the subroutine in there.
It's never going to get executed, it just has to exist!
The warnings can't be switched off btw.
I disagree!
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |