$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. Keywords: GAMS model library, GAMS language features $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 / /'e-mail: support@gams.com':<>rep.pw /'/':<>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';