I have reviewed the ZLINK documentation here:
https://docs.yottadb.com/ProgrammersGuide/commands.html#zlink
I would like to ZLINK a routine at runtime, and be aware if the compilation and linking generated any errors.
For example, I created a routine named TEST2, with the following erroneous code:
CHKERR2
SET X=
QUIT
And then I made another routine, TEST, with the following code.
CHKERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE=""""" . ZLINK "TMGTEST2"
QUIT
CHKMATHERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE=""""" . WRITE 1/0
QUIT
kdtop schrieb am Mittwoch, 17. August 2022 um 23:22:33 UTC+2:
I have reviewed the ZLINK documentation here:
https://docs.yottadb.com/ProgrammersGuide/commands.html#zlink
I would like to ZLINK a routine at runtime, and be aware if the compilation and linking generated any errors.
For example, I created a routine named TEST2, with the following erroneous code:
CHKERR2
SET X=
QUIT
And then I made another routine, TEST, with the following code.
CHKERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE="""""
. ZLINK "TMGTEST2"
QUIT
CHKMATHERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE="""""
. WRITE 1/0
QUIT
I don't know how to do it with ZLINK, but maybe my Workaround helps you:
TESTCOMPILE(FILE,RESULT) ;Compile FILE (no Object File created and return possible Errors in .RESULT
N IO,PIPE,I,LINE
S IO=$IO
S PIPE="PIPE"
KILL RESULT
O PIPE:(shell="/bin/bash":command="$gtm_dist/mumps -noobject "_FILE_" && echo '***READY'":readonly)::"PIPE"
U PIPE
S I=1000
F Q:$ZEOF R LINE Q:LINE="***READY" D
. I $E(LINE,1,12)=($C(9,9)_"At column ") S RESULT(I)=$P($P(LINE,"At column ",2),",",1)_";"_$P($P(LINE,"line ",2),",",1)_";"
. I $E(LINE,1,4)="%YDB"!($E(LINE,1,4)="%GTM") S:$G(RESULT(I))="" RESULT(I)=";;" S RESULT(I)=RESULT(I)_LINE,I=I+1
C PIPE
U IO
Q
Jens
On Wednesday, August 17, 2022 at 5:42:59 PM UTC-4, Jens wrote:
kdtop schrieb am Mittwoch, 17. August 2022 um 23:22:33 UTC+2:
I have reviewed the ZLINK documentation here:
$ZCSTATUS (https://docs.yottadb.com/ProgrammersGuide/isv.html#zcstatus) captures the result of a ZCOMPILE. I don't know whether it captures the result of a ZLINK and I can't check right now, but in case it does not, you can always do ZCOMPILE beforedoing the ZLINK (which in any case only recompiles if necessary).
Regards
– Bhaskar
kdtop schrieb am Mittwoch, 17. August 2022 um 23:22:33 UTC+2:
I have reviewed the ZLINK documentation here:
https://docs.yottadb.com/ProgrammersGuide/commands.html#zlink
I would like to ZLINK a routine at runtime, and be aware if the compilation and linking generated any errors.
For example, I created a routine named TEST2, with the following erroneous code:
CHKERR2
SET X=
QUIT
And then I made another routine, TEST, with the following code.
CHKERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE="""""
. ZLINK "TMGTEST2"
QUIT
CHKMATHERR
DO
. NEW $ETRAP
. SET $ETRAP="write ""Error Trapped: "",$ECODE,! set $ETRAP="""",$ECODE="""""
. WRITE 1/0
QUIT
I don't know how to do it with ZLINK, but maybe my Workaround helps you:
TESTCOMPILE(FILE,RESULT) ;Compile FILE (no Object File created and return possible Errors in .RESULT
N IO,PIPE,I,LINE
S IO=$IO
S PIPE="PIPE"
KILL RESULT
O PIPE:(shell="/bin/bash":command="$gtm_dist/mumps -noobject "_FILE_" && echo '***READY'":readonly)::"PIPE"
U PIPE
S I=1000
F Q:$ZEOF R LINE Q:LINE="***READY" D
. I $E(LINE,1,12)=($C(9,9)_"At column ") S RESULT(I)=$P($P(LINE,"At column ",2),",",1)_";"_$P($P(LINE,"line ",2),",",1)_";"
. I $E(LINE,1,4)="%YDB"!($E(LINE,1,4)="%GTM") S:$G(RESULT(I))="" RESULT(I)=";;" S RESULT(I)=RESULT(I)_LINE,I=I+1
C PIPE
U IO
Q
Jens
On Wednesday, August 17, 2022 at 9:47:43 PM UTC-4, K.S. Bhaskar wrote:doing the ZLINK (which in any case only recompiles if necessary).
On Wednesday, August 17, 2022 at 5:42:59 PM UTC-4, Jens wrote:
kdtop schrieb am Mittwoch, 17. August 2022 um 23:22:33 UTC+2:
I have reviewed the ZLINK documentation here:
...
$ZCSTATUS (https://docs.yottadb.com/ProgrammersGuide/isv.html#zcstatus) captures the result of a ZCOMPILE. I don't know whether it captures the result of a ZLINK and I can't check right now, but in case it does not, you can always do ZCOMPILE before
RegardsBhaskar,
– Bhaskar
Thanks for this reply. I did some more digging in the documentation about $ZCSTATUS and ZCOMPILE, and it seems that $ZSTATUS also returns information. Actually more verbose info:
yottadb>zcompile "/opt/worldvista/EHR/p/TMGTEST2.m"
SET X=
^-----
At column 9, line 1006, source module /opt/worldvista/EHR/p/TMGTEST2.m %YDB-E-EXPR, Expression expected but not found
yottadb>W $ZSTATUS
150373210,CHKMATHERR+4^TMGTEST,%YDB-E-DIVZERO, Attempt to divide by zero yottadb>W $ZCSTATUS
150372778
yottadb>
What keywords should I search for in the documentation to learn the meaning of the numbers for $ZCSTATUS? E.g. 150372778? There seems to be a difference between the numbers given for $ZSTATUS and $ZCSTATUS.
Thanks again
Kevin
before doing the ZLINK (which in any case only recompiles if necessary)....
$ZCSTATUS (https://docs.yottadb.com/ProgrammersGuide/isv.html#zcstatus) captures the result of a ZCOMPILE. I don't know whether it captures the result of a ZLINK and I can't check right now, but in case it does not, you can always do ZCOMPILE
RegardsBhaskar,
– Bhaskar
– Bhaskar
In our application run commands from remote servers in a separate process with this command:
s output=call("mumps -run ^%XCMD 'w "Hello!",!'")
We read the output from the command with a PIPE device like this:
call(command)
n (command)
s ret=""
s p="myProcSystemCall"_$job
o p:(shell="/bin/sh":command=command:READONLY)::"PIPE" u p
f r line q:$zeof s ret=ret_$s($l(ret):$c(10),1:"")_line
c p
q ret
This seems to work fine for zlink also. Just change the command 'w "Hello!"' above to call zlink instead.
BR,
Jens Lideström
o "c":(shell="/bin/sh":command="yottadb -noobject .yottadb/r/esvbug.m":stderr="e")::"pipe" u "c"%YDB-E-FMLLSTMISSING, The formal list is absent from a label called with an actual list: lab2
f r x q:$zeof u $p w x,! u "c"
u "e" f r x q:$zeof u $p w x,! u "e"
u $p c "c","e"
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 05:35:59 |
| Calls: | 12,100 |
| Calls today: | 8 |
| Files: | 15,003 |
| Messages: | 6,517,909 |
| Posted today: | 1 |