Initializing help system before first use

Trio output


Type: Programming
Rating: 1 (simple)
Description: Three ways of writing data to a text file using different formats (initializations to, free-format writeln, diskdata)
File(s): trio_out.mos

trio_out.mos
(!******************************************************
   Mosel User Guide Example Problems
   ================================= 

   file trio_out.mos 
   ````````````````` 
   Three ways of writing data to file.
 
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, 2001, rev. Dec. 2005
*******************************************************!)

model "Trio output"
 uses "mmetc"

 declarations
  A: array(-1..1,5..7) of real
 end-declarations

 A :: [ 2,  4,  6,
       12, 14, 16,
       22, 24, 26]

! First method: use an initializations block
 initializations to "out_1.dat"
  A as "MYOUT"
 end-initializations

! Second method: use the built-in writeln function 
 fopen("out_2.dat", F_OUTPUT)
 forall(i in -1..1, j in 5..7)
  writeln('A_out(', i, ' and ', j, ') = ', A(i,j))
 fclose(F_OUTPUT)

! Third method: use diskdata
 diskdata(ETC_OUT+ETC_SPARSE, "out_3.dat", A)

(! Alternatively, use 'diskdata' IO driver:
 initializations to 'mmetc.diskdata:'
  A as 'sparse,out_3.dat'
 end-initializations
!)

end-model

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.