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

The FAME HLI has an easy command for sending instructions to a FAME 4GL session, cfmfame(). To access this function, we include the rhli package.

library(qoma.smuggler)
library(rhli)

if(!open_hli())knitr::knit_exit()

We use FAME 4GL to generate uniform random numbers for a specified date range --- the business days of the prior quarter.

We demonstrate FAME timescale conversion and reporting.

txtfile <- file.path(tempdir(),"tmp.txt")
dbfile <- file.path(tempdir(),"tmp.db")
cmd <- Character(paste(
  "date thisday(q)-1; ",
  "freq b; ",
  "open<acc over>\"",dbfile,"\" as db; ",
  "series x : precision by date; ",
  "desc(x) = \"U[0,1]\"; ",
  "docu(x) = \"Uniformly distributed U[0,1] time-series.\"; ",
  "set x = uniform(date); ",
  "output<acc over>\"",txtfile,"\"; ",
  "whats x; ",
  "show vert; length full; conv on;",
  "freq b; title text \"Frequency \"+@freq; repo x; ",
  "freq w(fri); title text \"Frequency \"+@freq; repo x; ",
  "freq m; title text \"Frequency \"+@freq; repo x; ",
  "freq q; title text \"Frequency \"+@freq; repo x; ",
  "output terminal; ",
  "close db",  sep=""))
cfmfame(Integer(-1), cmd)
cat(readLines(txtfile), sep = '\n')

When finished accessing FAME,

close_hli()
file.remove(txtfile)
file.remove(dbfile)


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