$ fortran/object=z sys$input
       BYTE A(4),B(4)
       LOGICAL*4 CMPC3
       DATA A/1HA,1HB,1HC,1H /
       DATA B/1HA,1HC,1H ,1H /
       WRITE(*,*) CMPC3(4,A,B)
       WRITE(*,*) CMPC3(4,B,A)
       WRITE(*,*) CMPC3(4,A,A)
       WRITE(*,*) CMPC3(4,B,B)
       END
$
$ macro/object=z1 sys$input
        .title  z1
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
;cmpc3:: .call_entry home_args=true,max_args=3
        .entry  cmpc3,^m<>
        cmpc3   @4(ap),8(ap),12(ap)
        beql    100$
        movl    #0,r0
        ret
100$:   movl    #-1,r0
        ret
        .end
$
$ link z+z1
$ run z
$ fortran/object=z2 sys$input
      LOGICAL*4 FUNCTION CMPC3(L,S1,S2)
      INTEGER*4 L
      BYTE S1(L),S2(L)
      INTEGER*4 STR$COMPARE
      CMPC3=(STR$COMPARE(%DESCR(S1),%DESCR(S2)).EQ.0)
      RETURN
      END
$
$ link z+z2
$ run z
$ fortran/object=z3 sys$input
      LOGICAL*4 FUNCTION CMPC3(L,S1,S2)
      INTEGER*4 L
      BYTE S1(L),S2(L)
      INCLUDE '($DSCDEF)'
      RECORD/DSCDEF1/ SD1,SD2
      INTEGER*4 STR$COMPARE
      SD1.DSC$W_MAXSTRLEN=L
      SD1.DSC$B_DTYPE=DSC$K_DTYPE_T
      SD1.DSC$B_CLASS=DSC$K_CLASS_S
      SD1.DSC$A_POINTER=%LOC(S1)
      SD2.DSC$W_MAXSTRLEN=L
      SD2.DSC$B_DTYPE=DSC$K_DTYPE_T
      SD2.DSC$B_CLASS=DSC$K_CLASS_S
      SD2.DSC$A_POINTER=%LOC(S2)
      CMPC3=(STR$COMPARE(SD1,SD2).EQ.0)
      RETURN
      END
$
$ link z+z3
$ run z
$ cc/object=z4 sys$input
#include <string.h>

int cmpc3(int *l,char *s1,char *s2)
{
   if (memcmp(s1,s2,*l)==0) return -1; else return 0;
}
$
$ link z+z4
$ run z
$ exit
