FILEOPEN ... copyright (c) 1986 Allegro Consultants, Inc. Author: Stan Sieler FILEOPEN writes commented FOPEN calls in SPL, Pascal, C, and FORTRAN. FILEOPEN.USL is a procedure that can be added to your group, public, or system SL file. It can then be called from QEDIT or EDITOR via the "P" command. FILEOPEN.PUB is a program that demonstrates the FILEOPEN routine. FILEOPEN allows you to conversationally specify various file characteristics like: ASCII, BUF, NOBUF, MR, MULTI, MSG, record size, block factor, filecode, etc. It will then write the code to call FOPEN with the appropriate parameters from SPL, Pascal, C, or FORTRAN. This source code is written to a file called TEMP. NOTE: the file TEMP is always purged/created by every run of FILEOPN or call to the FILEOPEN procedure! To call FILEOPEN from QEDIT or EDITOR, first build an SL: :segmenter buildsl SL, 200, 1 usl fileopen.usl addsl fileopen; fpmap addsl fileopen2; fpmap exit Let's assume the SL is in your logon group... An example of using FILEOPEN from QEDIT is: run qedit.pub.robelle <---your input ... p fileopen, g <---your input ascii out new rec=-80 disc=20 <---your input // <---your input y <---your input The result is the file TEMP with the contents: move filename' := "AFILENAME"; fid := fopen (filename', %000004, <> %000001, <> -80, <> , <> , <> 0, <> 0, <> 0, <> 20d, <> 0, <> 0, <> 0); <> if <> then begin say "unable to open the-file-name:" spout; fcheck (fid, err); genmsgu (8, err); end; Try it! (Note: the Pascal and FORTRAN output even includes the declarations of the variables needed for the FOPEN call.) A standalone version of FILEOPEN is available in the program file FILEOPEN.PUB.ALLEGRO. This is a program which is essentially: begin fileopen; end. =============================================================== The rest of this file is a copy of the on-line help of FILEOPEN HELP is obtained by entering ? when prompted for fopen options. =============================================================== This is FILEOPEN...by Stan Sieler. FILEOPEN will write an FOPEN call for you in the language you chose at entry time. Enter the various FOPEN options that you want to specify. When you are all done, enter '//' and hit . The following keywords are recognized, and may be abbreviated to just the UPPER case portion: $NEWpass $NULL $OLDpass $STDIN $STDINX $STDList ASCii Append BINary BLOCK= BUF= CCTL CIR CODE= COPY DENsity= DEQ DEVice= DISC= EAR ENV= EXC EXEcute FEQ FORMS= Fixed GMULTI IN INOUT KSAM LABel LOCK MR MSG MULTI NATive NEW NOBUF NOCCtl NOLAB NOLOCK NOMR NOMULti NOWAIT OLD OLDPerm OLDTemp OUT OUTKeep REC= RIO RW SEMI SHR STD UNLABel UPDate Undef USERLabel= Variable WAIT FILE=filename AOPtion= FOPtion= NM CM Note that some of the keywords have parameters: AOPtion= # or %# (sets aoption word) BLOCK = blockfactor (1..255) BUFfers= #buffers (0..16) CODE = filecode (-32768..32767) DENsity= 800/1600/6250 DEVice = devicename (up to 64 chars) DISC = limit [,maxextents [,minextents]] ENV = environmentname (up to 35 chars) FILE = filename to open (up to 35 chars) FOPtion= # or %# (sets foption word) FORMS = formsmessage (up to 49 chars) REC = recsize[,blockfactor] USERlab= #labels (0..32767) Two other commands are accepted: SHOW ... shows the FOPEN call in the current language LANG ... prompts you to select a language (SPL/Pas/Ftn/C) If you are looking at an existing FOPEN call that has foptions or aoptions that you would like 'interpreted', you can get FILEOPEN to do it by simply 'setting' these words with the FOP/AOP commands. For example, if you see: fopen ( file', %4, %1) then tell FILEOPEN: fop %4 aop 1 and FILEOPEN will respond with their meaning. FileOpen 20140822