gamsrep.gms : The GAMS Model Library
This problem demonstrates the use of the PUT statement to write
reports. An include file GAMSMOD.INC includes data about the
GAMS model library. A summary report is written to REP.PUT.
Reference:
- GAMS Development Corporation, Formulation and Language Example.
Small Model of Type: GAMS Includes: gamsmod.inc gamsref.inc
$title The GAMS Model Library (GAMSREP,SEQ=101)
$stitle Application Areas
$Ontext
This problem demonstrates the use of the PUT statement to write
reports. An include file GAMSMOD.INC includes data about the
GAMS model library. A summary report is written to REP.PUT.
GAMS Development Corporation, Formulation and Language Example.
$Offtext
$include gamsmod.inc
$stitle Sample PUT Report
$eolcom ?
file rep report example; ? use default name REP.PUT
parameter gpage(a) page number;
rep.pc = 3; rep.pw=72; rep.ps = 55; rep.lm=6;
put rep #15
'The GAMS Model Library %version%':<>rep.pw
/// system.date:<>rep.pw
///'This report can be regenerated by':<>rep.pw
/'running the problem GAMSREP from ':<>rep.pw
/'the GAMS Model Library as follows':<>rep.pw
//'> gamslib gamsrep':<>rep.pw
/'> gams gamsrep':<>rep.pw;
rep.cr = rep.cr + 10;
put /'GAMS Development Corporation':<>rep.pw
/'1217 Potomac Street, NW':<>rep.pw
/'Washington, DC 2007':<>rep.pw
//'phone: 202-342-0180':<>rep.pw
/'fax: 202-342-0181':<>rep.pw
//'e-mail: sales@gams.com':<>rep.pw
/'http ://www.gams.com':<>rep.pw
putpage; rep.lp = 0;
puttl rep 'GAMS Model Library %version%' @(rep.pw-8) 'Page ' system.page:>4
/'Grouped by Application Area'//;
put // 'Grouped by Application Area':<>rep.pw //;
loop(a, ? loop over all application areas
putpage$(rep.ll+4 > rep.ws); ? allow for at least one entry
rep.hdll=0; ? reset header to nul
put / a.te(a) // ; ? print subtitle header
puthd a.te(a) ' (cont.)'// ; ? set header for page break
gpage(a) = rep.lp+1; ? save line number for index
loop((as(a,s),sm(s,m)), ? loop over all models by sequence
put s.tl:>4 ' ' ? print sequence number
m.tl:12 ? print model name (label)
m.te(m)/ ? print model text
) ? end of s loop
); ? end of a loop
putpage; rep.tlll=1; puttl 'By Sequence Number'//; rep.hdll=0;
scalar seqnumber starting page for seqential listing; seqnumber=rep.lp+1;
put // 'Grouped by Sequence Number':<>rep.pw //;
put 'Seq Name Title'/;
puthd 'Seq Name Title'//; ? add header to the next page
loop(sm(s,m), put / s.tl:>3 ' 'm.tl m.te(m) );
putpage; rep.tlll=1; puttl 'By Name'//; rep.hdll=0;
scalar namnumber starting page for name listing; namnumber=rep.lp+1;
put // 'Grouped by Name':<>rep.pw //;
put 'Name Seq Title'/;
puthd 'Name Seq Title'//; ? add header to the next page
loop((m,sm(s,m)), put / m.tl:9 s.tl:>3 ' ' m.te(m) );
putpage; rep.tlll=1; puttl 'By Include File'//; rep.hdll=0;
scalar incnumber starting page for name listing; incnumber=rep.lp+1;
put // 'Grouped by Include File':<>rep.pw //;
put 'Name Title'/;
puthd 'Name Title'//; ? add header to the next page
loop(inc, put / inc.tl:9 inc.te(inc) ;
loop((incmap(inc,s),sm(s,m)), put / ' ':3 m.tl:9 s.tl:>3 ' ' m.te(m) ));
* Make Table of Contents
putpage; rep.tlll=1; puttl //; rep.hdll=0; puthd 'Index Summary' //;
put 'Grouped by Application'/;
loop(a, put '...............................................'
'................' gpage(a):>5:0 @1 ' ' a.te(a) / );
put /'...............................................'
'................' seqnumber:>5:0 @1 'Grouped by Sequence Number' /
put /'...............................................'
'................' namnumber:>5:0 @1 'Grouped by Name' /
put /'...............................................'
'................' incnumber:>5:0 @1 'Grouped by Include File';