It is currently Mon Nov 20, 2017 5:34 pm


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: $ZN in MumpsV1 ?
PostPosted: Sun Jul 07, 2013 5:20 am 
User avatar

Joined: Sun Mar 27, 2011 8:12 am
Posts: 87
Location: Europe , HUNGARY
Real Name: Josef Nagy
Began Programming in MUMPS: 0- 0-1991
Hi

Some MUMPS implementation use the $ZN formula for actual routine name string .
In MUMPSV1 actual routine name string is = $G(^$J($J,"ROUTINE_NAME"))

BUT , if use in routine EXECUTE and in the executed commands string including this $G(^$J($J,"ROUTINE_NAME")) , return a empty string !!

My alternate solution , the STACK trace , something like :

Code:
%ZN()   ;Return Main routine name from STACK [ 07/07/2013 14:09 PM ]
        N 
        S %mref="",%st=0 F  Q:$F(%mref,"^")!(%st>99)  S %st=%st+1,%mref=^$J($J,"$STACK",^$J($J,"$STACK")-%st,"PLACE")
        Q $P(%mref,"^",2)


Usage : W $$^%ZN

Another idea ??

_________________
Josef Nagy
[MUMPS based industrial application in Processing Controll (MCU/PLC/MUX)]


Top
Offline Profile  
 
 Post subject: Re: $ZN in MumpsV1 ?
PostPosted: Mon Jul 08, 2013 3:43 am 
User avatar

Joined: Wed Jul 20, 2011 11:49 am
Posts: 9
Location: Russia, Moscow
Real Name: Eugene Karataev
Began Programming in MUMPS: 10 Mar 1997
Try to use function $TEXT inside routine context
$t(+0) is a special case of the $text argument to return current routine executed.


Top
Offline Profile  
 
 Post subject: Re: $ZN in MumpsV1 ?
PostPosted: Mon Jul 08, 2013 1:36 pm 
User avatar

Joined: Sun Mar 27, 2011 8:12 am
Posts: 87
Location: Europe , HUNGARY
Real Name: Josef Nagy
Began Programming in MUMPS: 0- 0-1991
This $t(+0) working inside routine , but in EXECUTE return empty string

Code:
;Test EXECUTED $ZN in MumpsV1
     W !,"ROUTINE="_$T(+0)
     S XS="ROUTINE=",XX="W !,XS_$T(+0)"
     X XX
     Q



[TMP]MCL> D ^BB

ROUTINE=BB
ROUTINE=
[TMP]MCL>

_________________
Josef Nagy
[MUMPS based industrial application in Processing Controll (MCU/PLC/MUX)]


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net