printing formatted strings to output

Hello,

I’m interested in printing formatted strings, where information about a model or solve is plugged into a string of my design.

I am aware that print formatting can be done using put commands when printing to a file. In the example of http://www.gams.com/mccarl/mccarlhtml/basics_of_put.htm, the code
put ’ Optimality status ’ tranport.modelstat:2:0 ;
writes a string like
Optimality status 1

This is exactly what I want, except that put commands can only be used to print to a file. In my case, I want to print such strings to the standard display output instead of to a file. Can anyone advise me about how to do this?

I’m submitting my GAMS models to a server and can not receive any files back. I can only receive back the solver message (ie. the displayed output), which is why I need to write desired information to the output in a structured way so that I can then retrieve it from the message string using a script.

Thank you for taking the time to read this. I’ll appreciate any insight you can give me.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Trish,

It’s worth mentioning that the output you see on the screen by default (what you call the standard display output) is called the GAMS log file. You can redirect this using the logoption={0,1,2,3} option described in the User’s Guide.

If you use an empty file name when declaring a put handle then GAMS assumes you mean the put output to go to the log file. That’s just what you want. Here’s a little example.

-Steve

set I / i1 * i10 /;
file log /‘’/; put log;
put ‘** This example sends put output to the log **’ /;
loop {I,
put ’ ’ ord(I):0:0 ’ ’ I.tl /;
};



On Thu, Jun 26, 2014 at 1:43 PM, Trish Gillett wrote:

Hello,

I’m interested in printing formatted strings, where information about a model or solve is plugged into a string of my design.

I am aware that print formatting can be done using put commands when printing to a file. In the example of http://www.gams.com/mccarl/mccarlhtml/basics_of_put.htm, the code
put ’ Optimality status ’ tranport.modelstat:2:0 ;
writes a string like
Optimality status 1

This is exactly what I want, except that put commands can only be used to print to a file. In my case, I want to print such strings to the standard display output instead of to a file. Can anyone advise me about how to do this?

I’m submitting my GAMS models to a server and can not receive any files back. I can only receive back the solver message (ie. the displayed output), which is why I need to write desired information to the output in a structured way so that I can then retrieve it from the message string using a script.

Thank you for taking the time to read this. I’ll appreciate any insight you can give me.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.



\

Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com

Fantastic, this is exactly what I needed. Thank you for the quick response!



On Thursday, June 26, 2014 7:05:30 PM UTC-4, Steven Dirkse wrote:

Trish,

It’s worth mentioning that the output you see on the screen by default (what you call the standard display output) is called the GAMS log file. You can redirect this using the logoption={0,1,2,3} option described in the User’s Guide.

If you use an empty file name when declaring a put handle then GAMS assumes you mean the put output to go to the log file. That’s just what you want. Here’s a little example.

-Steve

set I / i1 * i10 /;
file log /‘’/; put log;
put ‘** This example sends put output to the log **’ /;
loop {I,
put ’ ’ ord(I):0:0 ’ ’ I.tl /;
};



On Thu, Jun 26, 2014 at 1:43 PM, Trish Gillett wrote:

Hello,

I’m interested in printing formatted strings, where information about a model or solve is plugged into a string of my design.

I am aware that print formatting can be done using put commands when printing to a file. In the example of http://www.gams.com/mccarl/mccarlhtml/basics_of_put.htm, the code
put ’ Optimality status ’ tranport.modelstat:2:0 ;
writes a string like
Optimality status 1

This is exactly what I want, except that put commands can only be used to print to a file. In my case, I want to print such strings to the standard display output instead of to a file. Can anyone advise me about how to do this?

I’m submitting my GAMS models to a server and can not receive any files back. I can only receive back the solver message (ie. the displayed output), which is why I need to write desired information to the output in a structured way so that I can then retrieve it from the message string using a script.

Thank you for taking the time to read this. I’ll appreciate any insight you can give me.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.



\

Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdi...@gams.com
http://www.gams.com


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.