Procedure from library spcurve.lib (see spcurve_lib).
spcurve.lib
isCMcod2(i); i an ideal
presentation matrix of i, if i is Cohen-Macaulay of codimension 2 a zero matrix otherwise
Example:
LIB "spcurve.lib"; ring r=32003,(x,y,z),ds; ideal i=xz,yz,x^3-y^4; print(isCMcod2(i)); → -y,-x2, → x, y3, → 0, z