Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cache 5.0 rourine save and compile

120 views
Skip to first unread message

Valeriu Gontia

unread,
Mar 11, 2021, 1:56:36 AM3/11/21
to
Hello everyone !
I am trying to use the Cache ver. 5.0 routine ^%R
https://www.yumpu.com/en/document/view/36857498/using-the-cache-r-routine-intersystems-documentation
Can you tell me how to increase the buffer of the saved program?
The impression is that it is less than 32 kb.
Code:
rtnSAVE(head,code)
s rtname=$p(head,"~",1),namespace=$p(head,"~",2)
Znspace namespace
s code(0)=0
f j=1:1 s string=$p(code,$c(10),j) q:string="" d
. s code(j)=string
s code(0)=j-1
s name=rtname
s ext="INT"
s routine=name_"."_ext
s options="CS" ; Compile and Save
s errors="" ; empty list
s return = $$ROUTINE^%R(routine,.code,.errors,options)
s errcode=$$FMTERR^%R(.errors, .code)
i errcode'="" d
. s %fcgi("o","stdout",i)=errcode_$c(13,10)
e s %fcgi("o","stdout",i)="Compilation result: "_return_$c(13,10)
s %fcgi("o","header","Content-Type")="text/plain"
q
;;
In Cache itself, (studio) saves without problems
Doesn't want to use the code above. gives the impression
that by default is somewhere 8-16 kb ...

thank.

OldMster

unread,
Mar 11, 2021, 10:14:54 AM3/11/21
to
Might be helpful if you posted the error you are getting.
Message has been deleted

Valeriu Gontia

unread,
Mar 11, 2021, 12:09:46 PM3/11/21
to
четверг, 11 марта 2021 г. в 17:14:54 UTC+2, OldMster:
I transfer the text of the routine to the Cache server (ver 5.0) using AJAX.

//**** Save and Compile Routine
function f_compile() {
var str = routine_name.value;
var strc = str.substring(0, 1); // "^" extract simbol
if (~strc.indexOf("^")) {
document.getElementById("myTextarea").value = "";
alert("Attention, does not apply to Global !!!");
return;
}
if (zd.value == '') {
alert('The $ZDirectory must not be empty !!! This should be the path to the database folder. Click and select the area in the left menu !!!');
return;
}
var mumps_string = 'CO ' + routine_name.value + "{~}" + zd.value + "{~}" + editorUI.mirror.getValue();
var ret = AJAX("PUT", "/cache/do/" , mumps_string, null).responseText;
document.getElementById("myTextarea").value = ret;
}

If it's smaller (I'm guessing in the 8kb limit) it gets written and compiled successfully and I get a message in the browser about it. (Compilation result: 1 ^, SAVED, COMPILED,) When the text is larger, I get not an error, but this message (502 Bad Gateway).
In Cache's native studio, this size of routine is recorded and compiled - everything works fine.
I got the impression that there is a limit on the size of the transmitted string.

OldMster

unread,
Mar 11, 2021, 12:22:29 PM3/11/21
to
Your problem isn't in %R, but in the AJAX mechanism you are using to transfer the routine. Are you using Weblink, CSP, or something else?

Valeriu Gontia

unread,
Mar 11, 2021, 1:12:17 PM3/11/21
to
четверг, 11 марта 2021 г. в 19:22:29 UTC+2, OldMster:
I'm trying FCGI for now. https://github.com/informatik-aalen/FastCGI-for-GT.M
I've tried writing without ^R%
I am writing in a simple global. The same result. Part of the code is written. Can't figure out where I am doing wrong ...

RtnSaveAS(head)
s $ztrap="error"
k ^gonUTILITY
s rtname=$p(head,"{~}",1),nms=$p(head,"{~}",2),code=$p(head,"{~}",3)
zn nms
f j=1:1 s routine=$p(code,$c(10),j) Q:routine="" d
. s ^gonUTILITY(j)=routine
q
;;
In YottaDB and GT.M everything works fine. It turns out that Ajax has nothing to do with it.

OldMster

unread,
Mar 11, 2021, 1:39:56 PM3/11/21
to
I'm not familiar with FCGI, but it appears it was written for GT.M (and by extension YottaDB). What operating system are you running Cache 5 on? Does FCGI use a web server, or is it direct? I make extensive use of REST API's to both YottaDB and Cache, and the web server configuration is usually where my problem is.
Message has been deleted

Valeriu Gontia

unread,
Mar 11, 2021, 3:01:05 PM3/11/21
to
четверг, 11 марта 2021 г. в 20:39:56 UTC+2, OldMster:
I use Cache 5.0 in linux CentOS 7. FCGI a use a Nginx - web server. I can't use newer versions of Cache now, but I'll try to see how it behaves on newer versions. I tried it on Cache 2015 and it all works fine. I can assume that this is due to Csche 5.0 but what exactly I can not say

OldMster

unread,
Mar 11, 2021, 5:05:24 PM3/11/21
to
In the configuration manager, the 'Advanced' tab, in the 'Process' section, check the $ZF String size - FCGI may use $ZF to move the data back and forth. Mine is set to 32767, but maybe yours is set smaller.

Mark

Valeriu Gontia

unread,
Mar 12, 2021, 5:13:51 AM3/12/21
to
пятница, 12 марта 2021 г. в 00:05:24 UTC+2, OldMster:
Unfortunately, i have these settings exactly as you say.
$ZF String (bytes) = 32767.
I even increased $ZF Heap (bytes) =270336 mahimum
Today i tried this situation again exactly on Cache 2015. Everything works flawlessly.
I wanted to try this to work with an old version of Cache 5.0 in a web browser to edit and compile routines and globals.
After all, her native studio is intended only for Windows XP
Initially, we invented it for GT.M and YottaDB, then we thought that it would not be bad for Kashe 5.0, (probably also for MSM), but there are some nuances.

Alex Maslov

unread,
Mar 15, 2021, 4:05:27 AM3/15/21
to
Valeriu,
the source of your problem is the attempt to send the routine source as one line.
The maximum string size in Cache 5.0 is 32K charters, while in Cache 2015 it is ~ 3M characters.
An INT code is not explicitly limited in size, while an OBJ size has different limits in different Cache versions. I'd better not discuss it as the successful compilation of your routines in Studio proves that you aren't hitting the OBJ size limit yet.

HTH.
P.S. Asking such questions at https://community.intersystems.com/ usually provides quicker and better responses.
0 new messages