/* rexx */

call init
call acomp mvsstart
call acomp mvssupa
call ccomp start
call ccomp stdio
call ccomp string
call ccomp stdlib
call ccomp time
call ccomp errno
call ccomp assert
call ccomp signal
call ccomp locale
call ccomp ctype
call ccomp setjmp
call ccomp math
call ccomp pdptest
call clink mvsstart
call term
exit

init: procedure
  "delete sysprint"
  "delete syscprt"
  "delete syscerr"
  "alloc f(sysprint) da(sysprint) mod reus space(1,1) cyl",
      "dsorg(ps) cat"
  "alloc f(syscprt) da(syscprt) mod reus space(1,1) cyl",
      "dsorg(ps) cat"
return

acomp: procedure;arg ?file
  say "acomp" ?file
  "alloc f(syslib) da('sys1.maclib') shr reuse"
  "alloc f(syslin) new space(1,1) track reuse delete"
  "alloc f(sysin) da(pdpclib.c("?file")) shr reuse"
  "alloc f(sysut1) da(sysut1) new space(1,1) track reuse delete"
  "call 'sys1.linklib(iev90)' 'list,noxref,object,nodeck,batch'"
  say "rc from asm is" rc
  if (rc = 0) then do
      "alloc f(syslmod) da(pdpclib.ncalib("?file")) shr reuse"
      "alloc f(sysut1) new space(1,1) track reuse delete"
      "call 'sys1.linklib(iewl)' 'ncal,let,rent,reus'"
      say "rc from link is" rc
  end
  "free f(syslin)"
return

ccomp: procedure;arg ?file
  say "ccomp" ?file
  "alloc f(sysmsgs) da('sys1.c.sedcmsgs(edcmsge)') shr reuse"
  "alloc f(syslib) da(pdpclib.h) shr reuse"
  "alloc f(syslin) new space(1,1) track reuse delete"
  "alloc f(sysin) da(pdpclib.c("?file")) shr reuse"
  "alloc f(sysut7) new space(1,1) track reuse delete"
  "alloc f(sysut8) new space(1,1) track reuse delete"
  "call 'sys1.c.sedccomp(edccomp)' ",
      "'>>syscerr nomar,noseq,define(__MVS__)' asis"
  say "rc from c is" rc
  if (rc = 0) then do
      "alloc f(syslmod) da(pdpclib.ncalib("?file")) shr reuse"
      "alloc f(sysut1) new space(1,1) track reuse delete"
      "call 'sys1.linklib(iewl)' 'ncal,let,rent,reus'"
      say "rc from link is" rc
  end
  "free f(syslin)"
return

clink: procedure;arg ?file
  say "clink" ?file
  "alloc f(syslin) da(pdpclib.ncalib("?file") pdpclib.c(mvsopts)) shr"
  "alloc f(syslmod) da(pdpclib.linklib("?file")) shr reuse"
  "alloc f(sysut1) new space(1,1) track reuse delete"
  "alloc f(syslib) da(pdpclib.ncalib) shr reuse"
  "call 'sys1.linklib(iewl)' 'let,rent,reus'"
  "free f(syslin)"
  "free f(syslmod)"
  "free f(syslib)"
  say "rc from link is" rc
return

term: procedure
  "alloc f(sysprint) da(*) shr reus"
  "alloc f(sysin) da(*) shr reus"
return
