knitr::opts_chunk$set(echo = TRUE,comment='')

To use FAME HLI functions, include the package rhli. We will use cfmfame() to execute some FAME 4GL for the purposes of inspecting our FAME database writing skills.

library(qoma.smuggler)
library(rhli)

if(!open_hli())knitr::knit_exit()
dbname <- paste(Sys.getenv("FAME"),"util","driecon",sep="/")
cat(dbname)
famedata <- read_fame(dbname)
dbfile <- file.path(tempdir(),"tmp.db")
write_fame(dbfile,famedata)

Use 4GL to peek at data in FAME. Output here is a bit verbose. Note that after FAME catalogs the database, we loop through the objects and write the object documentation.

txtfile <- file.path(tempdir(),"tmp.txt")
cmd <- rhli::Character(paste(
  "open<acc read>\"",dbfile,"\" as db;",  
  "output<acc over>\"", txtfile, "\";",
  "cata db;", 
  "-/xl = wildlist(db,\"?\");",
  "loop for x in xl; type name(x); type docu(x)+newline;end;",
  "output terminal;",
  "close db;",
  sep=""))
rhli::cfmfame(rhli::Integer(-1), cmd)
cat(readLines(txtfile), sep = '\n')
close_hli()
file.remove(txtfile)
file.remove(dbfile)


qomaio/r-smuggler documentation built on May 27, 2019, 3:32 p.m.