TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Joey Snell
from: Daniel Doran
date: 1994-06-17 00:35:00
subject: Rexx Headaches, C++ Dream

JOEY SNELL had something deep to write about REXX headaches, C++ Dream

JS> Can anyone help me with a few lines of code to read a .cfg
JS> file in REXX

Here is a fragment from the middle of one of my REXX scripts that
reads a file:

 file='C:\BITMAP\[BITMAPS].LIST'             /*this is the file being read*/
 if 'READY:' \= stream(file,'c','open read') /*if file not available     */
 then CALL SysFileTree "C:\OS2\BITMAP\*.*", "bitmaps.",
"O"
                                             /*make a list of bitmaps    */
 else do;                                    /*else, read the file       */
 /* bitmaps selected from file */
     do index=1 to 999                       /*limited to 999 entries    */
         line=linein(file)                   /*read a line of the file   */
         if line="" then do;                 /*if no line, end of file   */
             bitmaps.0=index-1;              /*  set bitmaps.0 = count   */
             leave;                          /*  stop counting           */
         end
         bitmaps.index=line                  /*else, put line in bitmaps */
     end                                     /*      listing             */
 end
 call stream file,'c','close'                /*close the file            */

Your program would of course, look at each line, and if it began with
a '%', ignore it.  The 'substr' function would be useful for that.  If
it began with the word 'Translate', you would probably want to put the
two words that followed it into a list or lists.  I'd advise reading
the entire online doc (except for Queue interface) about REXX before
getting started.

 * KWQ/2 1.2e * A clean desk requires a large wastebasket.


--- QScan v1.064b

* Origin: * La Cantina BBS * El Paso 915-532-0332 v.32bis/DS 4G (1:381/123)
SEEN-BY: 54/54 620/243 632/348 640/820 690/660 711/409 413 430 807 808 809
SEEN-BY: 711/934 712/353 623 713/888 800/1 2442/0
@PATH: 381/123 900 3615/50 229/2 2442/0 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.