Hi there at IBM NetRexx Group.
Glad that I'm back on this community. Now, *I* do have problems to compile some quite ancient NetRexx Programs. Let me tell you what I did: Up to now, I did work with NetRexx 2.02 and Java 1.4. With no problems at all. Now, I did upgrade to NetRexx 2.05 ( I did get knowledge that it does even exist just a few weeks ago) and Java 1.6.018, I think. And NOW: I cannot compile my own NetRexx programs anymore. I am attaching: my classpath in classpath.txt my path in path.txt the sourcefile in Question in ReyFile.nrx ... and the problem in question ReyFile.problems Obvioulsy, for some yet unknown reason, the 'prefix' of the classes in the generated code is now DOUBLED (I think). Moreover, when I take the ReyFile.java.keep file, rename it to ReyFile.java, and try to compile it, I get oher errors, saying I cannot compiles Classes when annotation is not enabled. As I have the same problem with (all?) other classes as well (the *.nrx of most of them *not been modified* for just a while ..), doese anyone of you know what might be the *reason* ?? Funny! Any advise ? And thanks in advance, Tom. CLASSPATH=c:\Rey\ReyC.jar;c:\NetRexx\lib\NetRexxC.jar;c:\Programme\Java\jre6\bin;c:\Programme\Java\jdk1.6.0_10\lib\tools.jar PATH=c:\Rey;c:\NetRexx;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\UltraEdit;C:\Programme\java\jdk1.6.0_10\bin;C:\Programme\ooRexx;C:\Programme\simon 0.2\bin -- trace all /* ReyFile: new implementation of own file I/O routines */ /* (c) Thomas.Schneider, Sept. 2001 - 2008 */ /*********************************************************************/ /* new implementation of FILEIO */ /* for NetRexx, to speed things up a bit ... */ /*********************************************************************/ /* the 'deprecated' methods are the old Rexx notation INCLUDING */ /* the Filename in the parameter list, whereas normally the object */ /* oriented methods should be used */ /*********************************************************************/ /* 05.09.2001: original version */ /* 16.10.2001: Line Buffering (all lines in core) added */ /* 17.10.2001: 'final' methods used to increase performance */ /* 18.10.2001: Attached RAF for charin/charout with given start */ /* : location specified. Note that a ReyFile has EITHER */ /* : an INPUT Stream OR an OUTPUT stream OR a RAF-Stream */ /* : attached! Note that obviously RAF stream access is */ /* : powers of tenth (>100 times) slower than sequential */ /* : I/O, and thus only used when abolutely needed! */ /* 25.10.2001: function sequence resorted to avoid forward references*/ /* 30.10.2001: open, close etc must return Rexx */ /* : allow FD() for terminal I/O */ /* 02.11.2001: tested and released with Rey vs 2.22 */ /* : testcases are: testio1.nrx thru testio15.nrx */ /* 18.01.2001: vs 2.30: rename append --> extend, etc. */ /* 20.03.2002: askfor and info routines moved to separate package */ /* : ReyMsg */ /* 25.03.2002: function 'copyfile' added. */ /* 11.06.2002: m-files temporarily increased to 400 (too many files) */ /* 16.07.2002: method query_exists() added (returns FileFullName) */ /* 21.09.2002: vs. 4.00 (at home) */ /* 28.11.2002: FileList added (with given Mask) */ /* 16.12.2002: resolve multiple FD's pointing to same File! */ /* 16.02.2003: vs 4.02 : honour excplicit EOF character (hex 1A) */ /* 26.03.2003: max number of files again patched to 3000 (for Cob2MFC*/ /* 04.04.2003: allow optional file-path in sysfileid() */ /* 29.07.2003: sortfile added; return Null after close(trial version)*/ /* : 'sortfile' still buggy. do not yet release. */ /* 04.08.2003: FileFilters added (for EXECIO support) */ /* 06.11.2003: method 'movefile(fin,fout,inform)' added */ /* : method 'isEmpty(file)' added */ /* 31.12.2003: use environment Variable ReyHome when present */ /* 05.02.2004: function get_directory() added */ /* 14.02.2005: bug in method FileList corrected */ /* 14.05.2005: Filelist mask is now COMMA separated LIST of masks */ /* : we DO need this for the LOCATE and CHANGE commands */ /* : (for the DEFAULT extensions ) */ /* 16.06.2005: FileList method does now return a COMMA separated */ /* : List of File-Names */ /* : NO LONGER Implicit closed message wanted/needed */ /* 16.03.2007: split FileMask in Filelist into name and type part */ /* 06.04.2007: changed method lineout(Rexx,int) to accept Null */ /* : argument to reposition line to line-number */ /* : for conformance to Object Rexx */ /* : Test program in 'testout1.rex' (release 5.00) */ /* 20.07.2007: Rey release 5.00 */ /* : methods linesin, linesout added */ /* 04.09.2007: Translate MVS PDS-members to DOS/UNIX conventions */ /* : new method 'type' added (display on screen, but with */ /* : pause after 25 lines */ /* 06.09.2007: FileList does now return a STEM !!!! */ /* 02.01.2009: opt_auto_line DE-implemented */ /* 06.12.2009: Flag ReadAhead added for setting current input line */ /*********************************************************************/ options binary package Rey.RT import Rey.RT. class ReyFile extends File uses ReyMsg, ReyFunc, ReySymb properties private static version=Rexx '7.00' debug=Options.opt_debug trace_io = Int 0 -- debugged /************************************/ /* 0 = no I/O trace */ /* 1 = trace open/close/erase */ /* 2 =trace input */ /* 3 = trace output */ /* 4= trace IO (utility routines */ /* -1 = trace Current file changes */ /************************************/ n_files = int 0 /* current number of defined files */ m_files = int 3000 /* max number of defined FD's */ /* temp patch */ file_no = int 0 /* number of current file */ FileTable = ReyFile[m_files+1] /* table of accessed files */ FileNos = Rexx 0 /* stem of file-number by file-name */ /* 0 is undefined file-number */ CurFile = ReyFile null chunk_size= 10240 /* chunk-size used for quick I/O (size in bytes)*/ SEQUENTIAL=byte 1 /* File Organisation mode 1; sequential (default)*/ RANDOM =byte 2 /* random only used for CHAR I/O with given start*/ System_name = 'Rey' properties public static /* ... setup needed environment variables */ $props=System.getProperties() $classpath=$props.getProperty('java.class.path') $path=$props.getProperty('java.library.path') /*'... need file, path- and line-separator */ $ds=':' /* disk separator (release 5.00) */ $fs=$props.getProperty('file.separator') $ts='.' /* the filetype separator (always dot) */ $ps=$props.getProperty('path.separator') $ls=$props.getProperty('line.separator') $ls_length=$ls.length() /* length of line separator */ $user=$props.getProperty('user.name') $directory=$props.getProperty('user.dir') /* aktuelles Arbeits-verzeichnis*/ /*******************************************************************/ /* these are the new preferred names, but PP still uses */ /* the old ones! */ /*******************************************************************/ ready=Rexx 'READY:' /* ready msg for stream comnmand */ $EOFChar='001A'.x2c /* explicit EOF character */ ReyHome=$props.getProperty('ReyHome') properties public/* this are the properties of each ReyFile OBJECT*/ FileNo = Int 0 /* unique File-Number */ FileFile = File Null /* the associated FILE object */ FileName = Rexx '' /* the actual given file name */ FileFullName = Rexx '' /* the Fullname of the file (including path) */ /* FileDescr = FileDescriptor null */ FileAccess = Rexx '' FileMode = byte 0 /* 0=unknown, 1=input, 2=output,3=update */ FileStatus= byte 0 /* 0=unknown (not yet opened) */ /* 1=input,2=output(rewrite) */ /* 3=append, 4=update,-1=EOF*/ /* 5= Lines in Core (buffered LINES I/O) */ /* -1= EOF encountered (read) */ /* -2= File already closed */ FileOrganisation = byte 0 /* 0 = sequential, 1 = Random */ FileRecType = char 'V' /* 'V' = variable, 'F' = Fixed */ FileRecLen = int 0 /* 0 = variable, >0 record-length when given*/ FileDTS = Rexx '' /* Date time stamp */ existing = boolean 0 /* 1=file does already exist (before open) */ CurLine = Rexx '' /* the current (last) line read */ CurLineNo = int 0 /* the current (last) line-number read */ PendingLine = boolean 0 /* flag for pending line (for lines())*/ ReaDAhead = boolean 0 /* flag for ReadAhead (for lines()) */ needsUTF = boolean 0 /* 1 = read/write with UTF encoding */ FileSize = long -1 /* old File-size in bytes, -1= not yet known */ FileNumberOfLines = Int -1 /* currently unknown number of lines */ FileLinesBuffered = boolean 0 /* 1= file lines are held in core*/ FileLines = Rexx ''/*Indexed String(=Stem) for all Lines in core */ FileReadLocation = long 1 /*Read Location in bytes, 1 is first */ FileWriteLocation = long 1 /* Write Location in bytes, 1 is first */ /********************************************************************/ /* release 5.00 implement Filters */ /********************************************************************/ FileFilter = boolean 0 /* 1 if File has defined Filter */ FileZoneFrom = int 0 /* Zone from (char position), 0= no Zone */ FileZoneTo = int 0 /* Zone to (char position, <=0: up to end of line*/ FileLocateString = Rexx Null /* Location Strig, when given (like EXECIO)*/ FileFindString = Rexx Null /* Find String, when given (like EXECIO) */ FileAvoidString = Rexx Null /* Avoid String, when given (like EXECIO) */ properties private FileLowerName = Rexx '' /* must save old key !! */ PriorFileNo = int 0 /* backwards link for multiple files with same name*/ /* these properties are hidden to the user deliberately */ AttachedFIS = FileInputStream null /* attached File-Input-stream */ AttachedBIS = BufferedInputStream null/* att. buffered input stream*/ AttachedDIS = DataInputStream null /* attached Data Input Stream */ AttachedFOS = FileOutputStream null /* attached File-Output-Stream */ AttachedBOS = BufferedOutputStream null /* attached buffered output*/ AttachedDOS = DataOutputStream null /* attached Data Output Stream */ /* note that RANDOM access is only used for charin(text,start) and */ /* charout(text,start)! all other variants are resolved with */ /* buffered I/O streams (100-1000 times quicker!) */ AttachedRAF = RandomAccessFile Null /* attached RANDOM-File */ method init private info('ReyHome is:' ReyHome) return method get_version public static returns Rexx return version method ReyFile(name=Rexx) super(name) lower_name=name.lower() old_file_no=FileNos[lower_name] if old_file_no>0 then do /* only for test */ warning('file:' name 'already attached to file-no:' old_file_no) old_FD=FileTable[old_file_no] info(' Full name is:' old_FD.FileFullName) info(' please revise program!') /* displayFileTable() */ end file_no=0 loop file_no1 = 1 to m_files if file_no1 > n_files | FileTable[file_no1]=null then do file_no=file_no1 /* set global var */ leave /* free place found */ end end if file_no = 0 then abort('too many files open, max.='m_files) if file_no > n_files then n_files=file_no FileTable[file_no]=this this.FileNo=file_no this.FileName=name this.FileFile=File(name) this.existing=this.FileFile.exists() if this.existing then do this.FileFullName=FileFile.getAbsolutePath() this.FileSize=this.FileFile.length() /* get current FileSize (in Bytes)*/ this.FileStatus=0 /* 0: File defined, but not yet accessed */ this.FileDTS=DTS(FileName) /* ?? !"! */ end else do this.FileFullName=FileName this.FileSize=0 this.FileStatus=0 /* 0: File defined, but not yet accessed */ this.FileDTS=0 end /* this.FileDescr=FileDesciptor(FileName) */ FileLowerName=lower_name FileNos[lower_name]=file_no PriorFileno=old_file_no /* build backward link */ CurFile=this if trace_io <> 0 then do if FileType(name) <> 'log' & name <> '' then ReyMsg.info('TraceIO ReyFile: File:' name 'attached to file_no:' file_no) end return this method ReyFileNo(name=Rexx) public static returns int return FileNos[name.lower()] method FD(name=Rexx '') public static returns ReyFile /**************************************************************************/ /* a function returning the ReyFile File descriptor (FD) */ /* if the object(filename) is already known, this one is used */ /* if not, a new ReyFile object is created */ /* note that an empty reference (FD()) refers to the terminal */ /**************************************************************************/ /* release 5: translate MVS file names (PDS members) to ordinary names */ iparen=name.pos('(') if iparen > 0 then do xname1=name.substr(1,iparen-1) xname2=name.substr(iparen+1).strip('T',')') /* strip trailing paren */ xname=xname1'.'xname2'.txt' /* and add extension txt */ ReyMsg.info('MVS File-name:' name 'simulated by:' xname) name=xname end /***********************************************************************/ /* test Current file first !! */ if CurFile <> null then do if name=CurFile.Filename then do file_no=CurFile.FileNo return CurFile /* is already current*/ end end /************************************************************/ /* file is NOT the current File, so we must LOOKUP the file */ /* in the File Table */ /************************************************************/ file_no=ReyFileNo(name) /* lookup lowercase name */ if file_no > 0 then do CurFile=FileTable[file_no] if CurFile=null then CurFile=ReyFile(name) end else do /* file was not yet used, so create one */ CurFile=ReyFile(name) file_no=CurFile.FileNo end return CurFile /*********************************************************************/ method access(access_method=Rexx) public final returns ReyFile /* access defaults to READ */ if this.FileName='' then return FileTable[0] /* Terminal is always ok*/ Fx=this.FileFile do label accessing if access_method=null, access_method='' then access_method='INPUT' if (this.FileStatus > 0 | this.FileStatus=-1) - & access_method <>'CLOSE' then do /**************** NO longer a message needed ********* ReyMsg.info('File:' this.Filename 'status:' this.FileStatus- 'access:' access_method) if debug then ReyMsg.debug('implicit closing of file:' this.FileName 'for: '- access_method) ***************** NOR WANTED !! ********************/ this.close() end if trace_io <> 0 then ReyMsg.info('File No:' this.FileNo - 'Name:' this.FileName 'access method=' access_method) parse access_method.upper() access_meth access_options /* random access only when charin/charout with start are used!! */ if access_options.wordpos('RANDOM') > 0 then do if access_meth='INPUT' then RAFMode='r' else RAFMode='rw' /* read write */ /* other modes NOT supported by Java! */ AttachedRAF=RandomAccessFile(FileFile,RaFMode) FileSize=AttachedRAF.length() FileReadLocation=1 FileWriteLocation=1 if RAFmode='r' then FileStatus=1 else FileStatus=3 FileOrganisation=RANDOM return this end /* sequential access (or buffered lines access) */ select case access_meth /**** resource files (trial) funktioniert so nicht ***** when 'RESOURCE' then do /* try reading a RESOURCE file */ FileAccess='RESOURCE' resource_name=this.FileName AttachedFIS=getResourceAsStream(resource_name) AttachedBIS=BufferedInputStream(AttachedFIS) AttachedDIS=DataInputStream(AttachedBIS) FileStatus=1 /* ready for read */ end *********************************************************/ when 'INPUT','READ' then do if Fx.exists()= 0 then do ReyMsg.abort('Input file: 'this.FileName 'does not exist!') end if Fx.canRead() then do FileAccess='INPUT' AttachedFIS=FileInputStream(Fx) AttachedBIS=BufferedInputStream(AttachedFIS) AttachedDIS=DataInputStream(AttachedBIS) FileStatus=1 /* ready for read */ end else ReyMsg.abort('unable to read file:' FileName) end when 'OUTPUT', 'REWRITE', 'REPLACE' then do existing=Fx.exists if existing=0, existing & Fx.canWrite() then do FileAccess='OUTPUT' AttachedFOS=FileOutputStream(Fx) AttachedBOS=BufferedOutputStream(AttachedFOS) AttachedDOS=DataOutputStream(AttachedBOS) FileStatus=2 /* ready for REWRITE */ end else ReyMsg.abort('unable to REWRITE file:' FileName) end when 'EXTEND', 'APPEND', 'WRITE' then do existing=Fx.exists if existing=0, existing & Fx.canWrite() then do FileAccess='EXTEND' /* old PP access_method name */ append_mode=boolean 1 /* ok, we want to APPEND!! */ /* note that the append flag is ONLY available for */ /* for the variant of FileOutputStream using FileName!*/ AttachedFOS=FileOutputStream(this.FileName,append_mode) AttachedBOS=BufferedOutputStream(AttachedFOS) AttachedDOS=DataOutputStream(AttachedBOS) FileStatus=3 /* ready for APPEND */ end else ReyMsg.abort('unable to WRITE/APPEND to file:' FileName) end when 'UPDATE' then do /* currently TWO streams */ if Fx.canRead() & fx.canWrite() then do FileAccess='UPDATE' AttachedFIS=FileInputStream(Fx) AttachedBIS=BufferedInputStream(AttachedFIS) AttachedDIS=DataInputStream(AttachedBIS) AttachedFOS=FileOutputStream(Fx) AttachedBOS=BufferedOutputStream(AttachedFOS) AttachedDOS=DataOutputStream(AttachedBOS) FileStatus=4 /* ready for UPDATE */ end else ReyMsg.abort('unable to UPDATE file:' FileName) end when 'CLOSE' then do this.close() return this end otherwise do ReyMsg.abort('illegal access-method:' - access_method 'specified for file:' FileName) end end if access_options.wordpos('UTF') > 0 then this.needsUTF=boolean 1 if access_options.wordpos('LINES') > 0 then do if FileAccess='INPUT' | FileAccess='UPDATE' then this.load_lines() /* when no read is required, then do NOT read old stuff */ /* as the whole file is beeing rewritten ! */ FileLinesBuffered=boolean 1 end if trace_io <> 0 then say 'file:' Filename 'opened for:' FileAccess 'status:' FileStatus catch e1=FileNotFoundException ReyMsg.abort('File:' Filename 'does not exist, cannot:' access_method) catch e2=IOException ReyMsg.abort('cannot' access_method 'File:' Filename 'Exception:' e2) end accessing return this method lineout(oline=Rexx) public final returns int if oline=Null then return 0 /* skip Null lines */ do label put_line /* sequential IO: put oline to this.output */ if oline=null then oline='' if this=null, this.FileName=null, this.FileName='' then do ReyMsg.info(oline) return 0 end if FileStatus=0 then this.access('WRITE') CurLineNo=CurLineNo+1 CurLine=oline if trace_io = 3 then ReyMsg.info('file:' this.FileName 'out:' CurLineNo':'CurLine) /*test */ select when this.FileLinesBuffered then do FileLines[CurLineNo]=CurLine if CurLineNo>FileNumberOfLines then FileNumberOfLines=CurLineNo end when this.needsUTF then do AttachedDOS.writeUTF(oline) AttachedDOS.writeUTF($ls) /* new line */ end otherwise do AttachedDOS.writeBytes(oline) AttachedDOS.writeBytes($ls) end end /* select */ /* compute logical new WriteLocation */ FileWriteLocation=FileWriteLocation+oline.length()+$ls_length FileSize=max(FileSize,FileWriteLocation-1) catch e=IOException ReyMsg.abort('cannot write line:' oline 'to File:' FileName - 'IO-Exception:' e) end put_line return 0 method lineout(oline=Rexx,oline_no=int) public final returns int if FileStatus = 0 then this.access('WRITE LINES') CurLineNo=oline_no-1 /* position line-cursor before given line-no */ if oline=Null, oline=='' then return 0 /* release 5.00, to conform to Object Rexx*/ return lineout(oline) method lineout(f=Rexx,oline=Rexx) public static /*deprecated*/ returns int if oline=null then oline = Rexx '' if f=null, f='' then do /* output to terminal */ ReyMsg.info(oline) return 0 end return FD(f).lineout(oline) method charout(text=Rexx) final returns int if this=null, this.FileName=null, this.FileName='' then do ReyMsg.info(text'\-') return 0 end if this.FileStatus<2 then this.extend() /* default is extend */ if trace_io = 3 then ReyMsg.info('file:' this.FileName 'loc:' FileWriteLocation - 'charout:' text) do label write_pending_stuff select when FileOrganisation=RANDOM then AttachedRAF.WriteBytes(text) when this.needsUTF then AttachedDOS.writeUTF(text) otherwise AttachedDOS.writeBytes(text) end catch e=IOException ReyMsg.info('unable to write:' text 'to File:' FileName) ReyMsg.abort('Fatal I/O Exception:' e) end write_pending_stuff FileWriteLocation=FileWriteLocation+text.length() FileSize=max(FileWriteLocation-1,FileSize) return int 0 method charout(text=Rexx,start=long) final returns int if start <> FileWriteLocation then this.SeekTo(start) this.charout(text) return int 0 method charout(f=Rexx,text=Rexx) public static /*deprecated*/ returns int return FD(f).charout(text) method charout(f=Rexx,text=Rexx,start=long) public static /*deprecated*/ - returns int return FD(f).charout(text,start) method traceio(itrace=int 1) public static /* set trace_io */ trace_io=itrace return /* do still not deprecate open, as it is widely used !! */ method open(access_method=Rexx '') public returns Rexx /* ancient form for access */ xf=this.access(access_method) /* access returns file pointer, but */ return ready /* stream funcs return ready !!*/ method open(f=Rexx, access_method=Rexx) public static returns Rexx xf=FD(f); xf.access(access_method) return ready method read(f=Rexx) public static returns Rexx /* open for read */ /* does NOT read any line, but opens for read */ xf=FD(f); xf.access('INPUT') return ready method exists() returns boolean return FileFile.exists() method exists(f) public static returns boolean /* given filename */ return File(f).exists() method scratch() public final returns Rexx if trace_io <> 0 then ReyMsg.info('scratching file: 'this.FileName) deleted=boolean 0 if this.FileFile.exists() then deleted=this.FileFile.delete() else deleted=1 if deleted & trace_io <> 0 then ReyMsg.info('File:' this.Filename 'deleted') if deleted=0 then ReyMsg.info('*** unable to delete file: 'this.Filename '***') access('OUTPUT') return ready method scratch(f=Rexx) public static returns Rexx xf=FD(f); xf.scratch() return ready method delete(f=Rexx) public static returns Rexx xf=FD(f); xf.scratch() return ready method extend() public final returns Rexx if this.FileFile.exists()=0 then return this.scratch() this.access('EXTEND') return ready method extend(f=Rexx) public static /*deprecated*/ returns Rexx xf=FD(f); xf.extend() return ready method close() public final returns Rexx /* must still check if cascaded close is necessary at all, */ /* but at least it does now work !! 25.10.2001, Th. Schneider */ do label closing if FileStatus=0 then leave closing /* not opened, workaround */ if FileStatus=-2 then do if trace_io <> 0 then do ReyMsg.warning('File: 'this.FileName 'already closed, CLOSE'- 'ignored') ReyMsg.info('File:' this.FileName 'Status:' this.FileStatus - '(-2 = already closed)') end leave closing end if AttachedDIS <> null then do AttachedDIS.close() AttachedDIS = null AttachedBIS.close() AttachedBIS = null AttachedFIS.close() AttachedFIS=null end if AttachedDOS <> null then do if FileLinesBuffered then save_lines() AttachedDOS.flush() AttachedDOS.close() AttachedBOS.flush() AttachedFOS.flush() AttachedFOS.close() AttachedFOS=null;AttachedBOS=null;AttachedDOS=null end if AttachedRAF <> null then do AttachedRAF.close() AttachedRAF=null end if trace_io<>0 & this <> ReyMsg.FD_LogFile then ReyMsg.info('File: ' FileName 'closed.') catch e=IOException ReyMsg.warning('unable to close file: 'Filename 'exception:' e) ReyMsg.info('processing continues ...') end closing /* clear file-table entries (may be re-used) */ /* FileNos[this.FileLowerName]=PriorFileNo *** honour backwards link when present*/ file_no=this.FileNo FileNos[this.FileLowerName]=0 FileTable[file_no]=null CurFile=null file_no=0 this.FileNo=0 this.FileStatus= -2 /* File already closed */ this.FileReadLocation=1 this.FileWriteLocation=1 this.FileSize=this.FileFile.length() /* Size may have changed! */ /* this.FileFile=Null *** no File attached anymore *!!*/ /* imposible !! this=Null *** drop the object (test) */ return ready method close(f=Rexx) public static returns rexx if f='ALL' | f='' then do closeAllFiles return ready end /* close given file*/ FD_object=FD(f) xf=FD_object.close() FD_object=Null /* 29.07.2003, DROP FD_object after close */ return ready method flush() public if AttachedDOS <> null then do if FileLinesBuffered then save_lines() AttachedDOS.flush() AttachedBOS.flush() AttachedFOS.flush() end return method finalize() public /* finalize needed for implicit closing */ if this.FileStatus <> -2 & this.FileStatus <> 0 then this.close() return method closeAllFiles() public static /* close ALL (opened) files */ /* ... the first loop closes all ordinary files (expect the log-files) */ loop ii=1 to n_files CurFile=FileTable[ii] if CurFile=null then iterate name=CurFile.FileName if CurFile=ReyMsg.FD_LogFile then iterate /*close Logfile as last */ if CurFile.FileStatus <> 0 & CurFile.FileStatus <> -2 then do -- ReyMsg.info('closing file:' name 'Status:' Curfile.FileStatus) CurFile.close() /* close, if opened */ end FileTable[ii]=Null end -- ReyMsg.info('closing LOG-File') ReyMsg.closelog() -- close the LOG-File file_no=0 n_files=0 return method lineout() public /*deprecated*/ /* empty lineout is CLOSE in REXX!!*/ if this=null then return close() method charout() public /*deprecated*/ /* empty charout is CLOSE in REXX!*/ if this=null then return close() method linein() final returns Rexx /* the standard: get next line */ -- ReyMsg.line=Null -- new live if pendingLine then do ReyMsg.FD_infile=this.FD ReyMsg.infile=this.FileName ReyMsg.line=this.CurLine ReyMsg.line_len=ReyMsg.line.length() ReyMsg.line_no = this.CurLineNo pendingLine=0 return CurLine end -- ReyMsg.info('... reading line from:' this.FileName) loop label reading_line if AttachedFIS = Null then do CurLine=ReyMsg.askfor('Cmd>') if Curline = Null then Curline='Stop' if CurLine='Stop' then do CurLineno=0 ReyMsg.line=null ReyMsg.line_no=0 return Null /* empty line means EOF */ end return CurLine end if this.FileStatus=-1 then do ReyMsg.warning('File: 'FileName 'reading past EOF!') return null /* reading past EOF */ end if this.FileStatus=0 then this.access('INPUT') CurLineNo=CurLineNo+1 if FileLinesBuffered then do /* lines are in Core! */ CurLine=FileLines[CurLineNo] end else do label reading CurLine=AttachedDIS.readLine() catch e=IOException ReyMsg.abort('File: 'FileName 'can not read line:' CurLineNo - 'IOException:' e) end reading /* Test for explicit EOF-character */ if CurLine<> null then do if Curline.substr(1,1) =$EOFChar then do CurLine=null /* simulate EOF */ end end if \this.ReadAhead then do if CurLine=Null then do ReyMsg.line=null ReyMsg.line_no=0 ReyMsg.line_len=0 end else do ReyMsg.FD_infile=CurFile ReyMsg.infile=this.FileName ReyMsg.line=this.CurLine ReyMsg.line_len=ReyMsg.line.length() ReyMsg.line_no = this.CurLineNo end /* check Filter when InputFilter is given */ if FileFilter then do if \FilterLine(CurLine) then iterate reading_line end end if CurLine=null then do FileStatus=-1 PendingLine= 0 if debug then ReyMsg.debug(CurLineNo ': -EOF-') return CurLine end if trace_io=2 & CurLine <> Null then ReyMsg.info('File:' FileName 'line ' CurLineNo ':' CurLine) return CurLine end reading_line method linein(line_no=int,count=int 1) public returns Rexx /* see page 99 of classic Rexx book */ if this.FileStatus > 0 & FileLinesBuffered=0 then do error('RANDOM access line numbered file:' FileName - 'not opened properly') this.close() end if FileStatus=0 then this.access('READ LINES') if FileLinesBuffered=0 then this.load_lines() if line_no > FileNumberOfLines then do error('reading past end of File:' FileName) info('Line: 'line_no 'not present in File:' FileName) end CurLineNo=line_no-1 /* set line-number back by 1 */ if count=0 then return null return linein() method linein(f) public static /*deprecated*/ returns Rexx xf=FD(f); return xf.linein() method linein(f,line_no=int,count=int 1) public static /*deprecated*/ returns Rexx xf=FD(f); return xf.linein(line_no,count) method lines() final returns int /* function needs read-ahead in Rexx! */ do label read_ahead if this=null, this.Filename=null, this.FileName='' then return 1 /* terminal has always lines*/ /* need at least READ-access for lines() function */ if this.FileStatus=0 then this.access('INPUT') if this.FileStatus<0 then return 0 /* already at EOF or already closed*/ if FileLinesBuffered then return FileNumberOfLines - CurLineNo /*easy case */ if PendingLine then return 1 /* no EOF, as line is still pending */ this.ReadAhead=1 this.linein() /* no line pending, so read ahead 1 line */ this.ReadAhead=0 PendingLine=1 /* ok, now we have a line pending !!*/ if CurLine=Null then do FileStatus=-1 /* indicates EOF */ PendingLine=0 /* EOF always is pending */ return 0 /* no more lines in File */ end return 1 /* still more lines in Buffer */ end read_ahead method lines(f) public static /*deprecated*/ returns boolean xf=FD(f); return xf.lines() /* new release 5.00 methods */ method linesin(f,n) public static returns Rexx xf=FD(f); return xf.linesin(n) method linesin(n=int) public returns Rexx stem= Rexx '' /* the indexed string (stem) returned */ n1= int 0 loop forever if this.lines() =0 then leave n1=n1+1 stem[n1]=this.linein() if n>=0 & n1 >= n then leave end stem[0]=n1 return stem method linesout(f,stem) public static xf=FD(f); xf.linesout(stem) xf.flush() /* Flush the buffers after STEM I/O */ return method linesout(stem=Rexx) public n1=int stem[0] i = int 0 loop i=1 to n1 this.lineout(stem[i]) end return method alloc(FIL=Rexx,DSN=Rexx,opts=Rexx '') public static returns ReyFile info('alloc FIL:' FIL 'DSN:' DSN 'options:' opts) info('-- not yet implemented --') return ReyFile Null method free(FIL=Rexx, opts=Rexx '') public static returns ReyFile info('free FIL:' FIL) info('-- not yet implemented --') return ReyFile Null method fileid(fn=Rexx, ft=Rexx '',fp=Rexx '',fd=Rexx '') - public static returns Rexx if ft='-' then ft='' /* needed in parsefid */ if ft <> '' then fx=fn||$ts||ft else fx=fn if fp<>'' then do len=fp.length if fp.substr(len,1)=$fs then fx=fp||fx else fx=fp||$fs||fx end if fd <> '' then fx=fd':'fx if trace_io >= 4 then info('FileID('fn','ft','fp','fd') returns:' fx) return fx method workfile(fn=Rexx, ft=Rexx, fp=Rexx '') - public static returns Rexx /* workfile needed for CMS version */ return fileid(fn,ft,fp) method parsefid(fid=Rexx) public static returns Rexx /* return blank delimited fn ft fm */ ic_ft=fid.lastpos($ts) if ic_ft>0 then do fn=fid.substr(1,ic_ft-1) ft=fid.substr(ic_ft+1,fid.length()-ic_ft) end else do fn=fid; ft='' end ic_fs=fn.lastpos($fs) if ic_fs > 0 then do fp=fn.substr(1,ic_fs-1) fn=fn.substr(ic_fs+1,fn.length()-ic_fs) end else fp='' if trace_io =4 then ReyMsg.info('parsefid('fid') returns: ' fn ft fp) if fp <> '' & ft = '' then ft='-' return fn ft fp /* returns name, type, path !!*/ method filename(fid) public static returns Rexx return parsefid(fid).word(1) method filetype(fid) public static returns Rexx xfid=parsefid(fid) if xfid.words()>1 then do ft=xfid.word(2) if ft='-' then ft='' /* needed in parsefid */ return ft end else return '' method filepath(fid) public static returns Rexx xfid=parsefid(fid) if xfid.words>2 then return xfid.word(3) else return '' method unpack(packed_fid, fid) public static returns Rexx ReyMsg.error('Unpack:' packed_fid 'not available in Java!') return ready method fullname(fid) public static returns Rexx return File(fid).getAbsolutePath() method ispacked(fid) public static returns boolean return 0 /* no packed files currently supported in Java */ method isopen(fid) public static returns boolean $$f=ReyFile.FD(fid) if $$f.FileStatus > 0 then return 1 else return 0 method erase(fid) public static /*deprecated*/ if trace_io <> 0 then ReyMsg.info('deleting(erasing) File:' fid) file_no=ReyFileNo(fid) if file_no>0 & isopen(fid) then do ReyMsg.warning('erase file:' fid 'file is still open,' - 'implcit closing activated') ReyFile.close(fid) end File_fid=File(fid) /* do NOT build a ReyFile Object!*/ if File_fid.exists()=0 then return /* use FILE-method 'exists': file does not exist*/ deleted=File_fid.delete() if deleted=0 then do ReyMsg.error('unable to delete File:' fid) File_Path=File_fid.getabsolutePath() ReyMsg.info('absolute path:' File_path) ReyMsg.info('ReyFile.FileNo: 'quoted(FileNos[fid.lower()])) return end if trace_io<> 0 & deleted then ReyMsg.info('File:' fid 'successfully deleted!') return method erase() public /*deprecated*/ returns rexx this.erase(Filename) return ready method purge(flist) public static /*deprecated*/ loop while flist <> '' parse flist f';' flist if exists(f) then erase(f) end return method stream(stream_name=Rexx '', operation=Rexx '', command=Rexx '')- public static /*deprecated*/ returns Rexx operation=operation.substr(1,1).upper() parse command.upper() cmd access_mode $$stream=FD(stream_name) /* build the file desciptor */ select case operation when 'C' then do/* Stream comand given */ select case cmd when 'OPEN','O' then $$stream.access(access_mode) when 'CLOSE','C' then $$stream.close() when 'SEEK' then do ReyMsg.warning('stream:' stream_name - 'command:' command 'currently ignored!') return 0 /* attempt is OK */ end otherwise do ReyMsg.abort('File:' stream_name 'illegal comand:' - command 'encountered!') end end end when 'Q' then do /* QUERY */ ReyMsg.error('stream QUERY' stream_name 'not yet implemented') end when 'S', '' then do /* STATUS' */ ReyMsg.error('stream STATUS' stream_name 'not yet implemented') end otherwise ReyMsg.abort('illegal operation:' operation 'cmd:' command - 'on stream:' stream_name 'requested.') end /* select operation */ return 'READY:' method length(file=Rexx) static public returns long if file='' then return 1 /* console always has length 1 */ jlength=File(file).length() /* directly use Java function */ if trace_io = 4 /* debug*/ then info('File:' file 'has length:' jlength 'bytes') return jlength method DTS() public static returns Rexx return ReyTime.dts() method DTS(file=Rexx) public static returns Rexx /* directly use File(file) to avoid a bunch of assigned FD's!! */ /* return Date time stamp*/ if \ exists(file) then return '' dlm=File(file).lastModified() cal=GregorianCalendar() cal.setTime(Date(dlm)) YYYY=cal.get(Calendar.YEAR) MM = Rexx(cal.get(Calendar.MONTH) + 1).right(2,'0') DD = Rexx(cal.get(Calendar.DATE)).right(2,'0') /* is the DAY !!! */ hh = Rexx(cal.get(Calendar.HOUR_OF_DAY)).right(2,'0') nn = Rexx(cal.get(Calendar.MINUTE)).right(2,'0') ss = Rexx(cal.get(Calendar.SECOND)).right(2,'0') nnnn=Rexx(cal.get(Calendar.MILLISECOND)*10).right(4,'0') dts1=YYYY'-'MM'-'DD hh':'nn':'ss nnnn if trace_io=4 then info('File:' file 'has DTS:' dts1) return dts1 /*********************************************************************/ /* sequential character oriented Input routines */ /* These routines should (must) be used for FIXED LENGTH records */ /* which will NOT be ended by a carriage return/linefeed ($ls) */ /*********************************************************************/ method chars() public final returns long if this.FileStatus=0 then this.access('INPUT') return FileSize - FileReadLocation +1 method chars(file=Rexx) static public /*deprecated*/ returns long return FD(file).chars() /*** --- method charin() public returns Rexx /* read a single char */ /* but note that the returned type is Rexx! */ /* we must still decide wether we should read a chunk*/ /* on each call --> open issue list */ if this.FileStatus=0 then this.access('INPUT') if FileOrganisation=RANDOM then byte1=AttachedRAF.readByte() else byte1=AttachedDIS.readByte() /* read a byte */ FileReadLocation=FileReadLocation+1 return Rexx byte1 --- ***/ method charin(n=int chunk_size) public returns Rexx /* read n bytes from current loc*/ /* note, that NOW by default a chunk is read, NOT 1 byte */ /* an appropriate attention message is given by the converter! */ /* ============================================================*/ if this.FileStatus=0 then this.access('INPUT') m=chars(); /* max. number of characters still available */ if m<n then n=int m if n <= 0 then return '' /*nothing left! */ do label read_chunk chunk=byte[n] /* declare a BYTE buffer of size 'n' */ if FileOrganisation=RANDOM then AttachedRAF.readFully(chunk) else AttachedDIS.readFully(chunk) FileReadLocation=FileReadLocation+n /* advance read loc */ chunks=String(chunk) /* luckily converts byte arr to String! */ return Rexx chunks catch EOFException error('unexpected EOF in File:' this.FileName) info('FileSize is .......:' FileSize) info('FileReadLocation is:' FileReadLocation) info('attempt to read' n 'bytes failed with EOFException!') FileSize=FileReadLocation-1 return Rexx '' /* empty string for EOF */ end read_chunk method charin(start=long,n=int) public returns Rexx /* see page 86 of 'The REXX language! */ if this.FileStatus=0 then this.access('READ RANDOM') if start>0 & FileReadLocation<> start then seekTo(start) if n=0 then return null return charin(n) method charin(file=Rexx,start=long,n=int) public static - returns Rexx return FD(file).charin(start,n) /*********************************************************************/ /* ... filespec function (of object rexx) */ /*********************************************************************/ method filespec(option=Rexx, spec=Rexx) public static /*deprecated*/ - returns Rexx opt=option.substr(1,1).upper() /* only leading character counts */ select case opt when 'N' then return nametype(spec) /* name and type !! */ when 'D' then return filedrive(spec) /* separate drive */ when 'P' then return filepath(spec) /* path including drive !? */ when 'I' then return filename(spec) /* filename part only (without type) */ when 'T' then return filetype(spec) /* filetype part only (without name) */ otherwise abort('unknown option in filespec('option','spec')') return '?' /* will never be reached, as abort stops */ end method nametype(file=Rexx) public static returns Rexx /* name INCLUDING type */ name=filename(file) /* file name WITHOUT type */ type=filetype(file) /* file type or '' */ if type <> '' then return name'.'type else return name /* no type */ method filedrive(file=Rexx) public static returns Rexx /* drive only */ if file.substr(2,1)=':' then return file.substr(1,1) else return '' method sysfileid(fn=Rexx,ft=Rexx '',fp=Rexx '') public static returns Rexx /* first, try current directory */ file1=fileid(fn,ft) if File(file1).exists() then return file1 /* second, try given path (but ONLY if given)*/ if fp <> '' then do file1=fileid(fn,ft,fp) if File(file1).exists() then return file1 end /***********************************************/ /* third, try classpath */ -- info('trying to find:' file1 'in classpath:' $classpath '$ps='$ps) path=$classpath loop while path <> '' parse path path1($ps)path file2=fileid(fn,ft,path1) if File(file2).exists() then return file2 end /* fourth: try path */ -- info('trying to find:' file1 'in path:' $path ',$ps='$ps) path=$path loop while path <> '' parse path path1($ps)path file2=fileid(fn,ft,path1) if File(file2).exists() then return file2 end warning('Required System File:' file1 'cannot be found!') return file1 /* return original name (file may still not exist)*/ method query_exists() public returns Rexx if \this.exists() then return '' return FileFullName method FileDateTime() public /*deprecated*/ returns Rexx /* american Format */ if this.FileDTS='' then return '' parse this.FileDTS yyyy'-'mm'-'dd' 'hhxmmxss . return mm'/'dd'/'yyyy hhxmmxss method FileTimeStamp() public returns Rexx /* ISO format */ if this.FileDTS='' then return '' return this.FileDTS method FileFormat() public /*deprecated*/ returns Rexx /* CMS QUERY format */ return FileRecType' 'FileRecLen method FileInfo() public /*deprecated*/ returns Rexx /* CMS QUERY Info */ return FileFormat() FileNumberOfLines FileDateTime() method load_lines() private /* load entire line-numbered file to core*/ if trace_io>0 then info('Loading lines of File:' FileName - 'into core') i_line=int 0 FileLinesBuffered=boolean 0 /* reset for following linein-calls */ FileLines = Null /* Drop old lines buffer, if any */ FileLines= '' /* establish as Indexed string again */ i_line=0 loop while this.lines() > 0 x=this.linein() i_line=i_line+1 FileLines[i_line]=x x=null end FileLinesBuffered=boolean 1 CurLineNo=0 /* no current Line Number */ CurLine=Null /* no current Line */ FileNumberOfLines=i_line info('after loading:' FileName 'number of lines is:' FileNumberOfLines) FileStatus=5 /* File Lines loaded into core */ return method save_lines() private /* save entire line numbered file from core */ FileLinesBuffered= boolean 0 /* reset for following lineout-calls */ loop i_line=1 to FileNumberOfLines this.lineout(FileLines[i_line]) end CurLineNo=0 /* no current line number after save */ CurLine=Null /* and no current line */ FileLinesBuffered= boolean 0 /* lines are no longer buffered */ FileLines=Null /* release FileLines buffer */ return method SeekTo(start=long) public returns long do label seeking_to_start if start=0 then return FileReadLocation if start=FileReadLocation then return FileReadLocation if FileOrganisation \= RANDOM then do error('File:' FileName 'not accessed in RANDOM mode') abort('please correct program!') end JavaPos= long start-1 /* ReyFile starts at 1, Java at 0*/ AttachedRAF.seek(JavaPos) FileReadLocation=JavaPos+1 FileWriteLocation=FileReadLocation /* synchronise pointers again */ return FileReadLocation catch e=IOException error('IO Exception: 'e 'encountered') abort('unable to position File:' FileName 'to location:' start) return long 0 /* avoid NetRexx Error Message !! */ end seeking_to_start method copyfile(fin=Rexx,fout=Rexx,inform=boolean 0) public static - returns int if \exists(fin) then do ReyMsg.error('file:' fin 'does not exist -cannot copy:' fin 'to:' fout) end FD_fin=ReyFile.FD(fin).access('READ') FD_fout=ReyFile.FD(fout).access('REWRITE') buf_size=int 1024*64 /* 64 K buffer for copyfile!*/ if trace_io>3 then do info('COPYING File:' FD_fin.FileName '(' FD_fin.FileSize 'bytes)') info(' to File:' FD_fout.FileName) end loop while FD_fin.chars() > 0 sbuf=FD_fin.charin(buf_size) sbuf_size=sbuf.length /* for debug messages */ if sbuf_size=0 then leave FD_fout.charout(sbuf) catch e=IOException ReyMsg.error('unexpected IO Exception: 'e 'encountered') ReyMsg.info('copying of File:' FD_fin.FileName 'to:'- FD_fout.FileName 'interrupted!') ReyMsg.abort('incomplete output file, unable to continue.') end FD_fin.close() FD_fout.close() sbuf=null /* drop buffer */ if FD_fin.FileFile.length() <> FD_fout.FileFile.length then do abort('Fatal COPYFILE-error, output file truncated?') end if inform then ReyMsg.info('File:' fin 'copied to:' fout) return 0 method movefile(fin=Rexx,fout=Rexx,inform=boolean 0) public static returns int if \exists(fin) then do ReyMsg.error('File:' fin 'does not exist, eannot move to:' fout) abort() end copyfile(fin,fout,0) erase(fin) if inform then ReyMsg.info('File:' fin 'moved to:' fout) return 0 method isEmpty(fin=Rexx) public static returns boolean /* tests if file is empty */ iflag=boolean 0 if \exists(fin) then do error('File:' fin 'does NOT exist, cannot test for EmptyNess') return 1 end temp_FD=ReyFile(fin) if temp_FD.FileSize>0 then iflag=0 else iflag=1 temp_FD=Null /* drop FD */ return iflag method max(x=long,y=long) private returns long if x> y then return x else return y method getDirectory() public static returns Rexx return ReyFile.$directory method getReyHome() public static returns Rexx if ReyHome \= Null then do info('using given environment variable ReyHome:' ReyHome) return ReyHome /* environment variable used*/ end path=$classpath /* searching for ReyHome in classpath */ info2('searching for ReyHome:') info('classpath is:' path) loop while path <> '' parse path path1($ps)path ds2=$ds||$fs if path1.pos(ds2) > 0 then do parse path1 disk2 (ds2) path2 ($fs) etc2 end else do parse path1 ($fs) path2 ($fs) etc2 disk2='' end /* info('path2=' path2 'etc2=' etc2) */ if path2='Rey' & etc2 = '' then do ReyHome=path1 leave end if path2='Rey' & etc2='ReyR.jar' then do ReyHome=path2 if disk2 <> '' then ReyHome=disk2||ds2||path2 leave end end if ReyHome = '' then do error('unable to determine Rey Home Directory') abort('Please set Environment Variable ReyHome to proper directory') end if opt_verbose > 2 then info('... using ReyHome:' ReyHome) return ReyHome method getReyRJar() public static returns Rexx Jar=getReyHome()||$fs||'ReyR.jar' info('... using Rey Run-Time Library:' Jar) return Jar method getReyCJar() public static returns Rexx Jar=getReyHome()||$fs||'ReyC.jar' info('... using Rey Compiler Library:' Jar) return Jar /********************************************************/ /* getRexx2NrxJar still there for upwards compatibility */ /********************************************************/ method getRexx2NrxJar() public static returns Rexx return getReyRJar() method query_exists(fname=Rexx) public static returns Rexx if \File(fname).exists then return '' ffull=ReyFile.FD(fname).FileFullName info('in query_exists, fullname is:' ffull) return ffull method FileList(file_list= Rexx '',dir_name= Rexx '.', extensions= Rexx '') public static returns Rexx /*********************************************************************/ /* FileList is NEEDED for CLASSIC REXX programs, as those cannot */ /* process a STRING ARRAY !! */ /*********************************************************************/ /*********************************************************************/ /* also, file_list is now a BLANK separated List of mask entries */ /* extensions is a BLANK separated list of possible extension */ /*********************************************************************/ if dir_name='.' | dir_name ='' then dir_name=ReyFile.$directory if trace_io > 0 then do info2('Processing Directory/File:' dir_name) info('Given List:' quoted(file_list)) info('extensions wanted:' quoted(extensions)) end FileDir=File(dir_name) if FileDir.isDirectory() = 0 then do error('File:' dir_name 'is NO directory') return '' end name_list=FileDir.list() /* note that name_list is a String ARRAY!*/ n_names=name_list.length /* number of entries */ if trace_io then info('>> Directory contains:' n_names 'entries') result_Stem = Rexx '' /* this is a ReyStem Now*/ n_results=0 /* the number of results, returned in stem.0 */ loop i=1 to n_names file_name1=name_list[i-1] /* note that Java Arrays start with 0 */ if File(file_name1).isDirectory then iterate i /* skip directories */ /* later, we may allow recursions */ /* first, check extension, when extensions are given */ name1 = FileName(file_name1) type1 = FileType(file_name1) if extensions <> '' & \is_member(type1,extensions) then iterate i /* when NO file-mask is given, all files with the proper extension are selected*/ if file_list='' | file_list ='*.*' then do n_results=n_results+1 result_Stem[n_results]=file_name1 iterate i end /* we do now quietly change COMMAS to blanks */ file_list=file_list.changestr(',',' ') loop ix=1 to file_list.words file_mask1=file_list.word(ix).strip() /* ... split Mask into filename and filetype part */ name_mask1=FileName(file_mask1) type_mask1=FileType(file_mask1) if masked(name1,name_mask1) & masked(type1,type_mask1)then do n_results=n_results+1 result_Stem[n_results]=file_name1 iterate i end /* if */ end--loop over file_masks end--loop i result_Stem[0]=n_results return result_Stem method displayFileTable public static info2('FileTable of current program:') loop ii= 1 to n_files fx=FileTable[ii] if fx=null then iterate fn=fx.FileFullName info('#'ii ':' fn) end return /******************* method sortfile(filein,fileout=Rexx '',keyloc=int 1) public static returns int if fileout='' | fileout=filein then do fileout=fileid('temp','$sort') sort_in_place=1 end else sort_in_place=0 /* use SYSTEM-command SORT */ xcmd='SORT < 'filein '> 'fileout if keyloc > 1 then xcmd=xcmd '/+'keyloc info('executing SORTFILE: cmd:' xcmd) rc=SysCmd.cmd(xcmd) info('RC after sort:' rc) if rc<> 0 then do error('System SORT: 'xcmd 'NOT completed.') return rc end if sort_in_place then do rc=copyfile(fileout,filein) /* fileout is temporary work file*/ if rc <> 0 then do error('SORT in PLACE: cannot copy file:' fileout 'to:' filein) return rc end erase(fileout) end return rc ****************************/ /******************************************************************************/ /* IO Filter processing (needed for EXECIO, but useful anyway ... */ /******************************************************************************/ /* currently implemented within ReyFile */ /* later, we may support a List of Filters as well, but currently we only */ /* support ONE Filter (like EXECIO) */ /* as Filter Processing only needs a couple of source line, it is now directly*/ /* implemented in ReyFile but with Private properties, so that we may change */ /* this later when desired. Th. Schneider, 04.08.2003 */ /******************************************************************************/ method setFilter(zone_from=int,zone_to=int,Locate_String=Rexx Null, - Find_String=Rexx Null, Avoid_String=Rexx Null) public FileFilter = 1 /* 1 = File has defined Filter */ FileZoneFrom = zone_from /* Zone from (char position), 0= no Zone */ FileZoneTo = zone_to /* Zone to (char position) */ /* <=0: up to end of line */ FileLocateString = Locate_String /* Locate String, when given */ FileFindString = Find_String /* Find String (in Zone) */ FileAvoidString = AVoid_String /* Avoid String, when given (like EXECIO)*/ if FileLocateString = '' then FileLocateString = Null if FileFindString = '' then FileFindString = Null if FileAvoidString = '' then FileAvoidString = Null return method setFileFilter(this_FileName=Rexx, zone_from=int,zone_to=int, - Locate_String=Rexx Null, - Find_String=Rexx Null, Avoid_String=Rexx Null) public static this_FD=FD(this_FileName) this_FD.setFilter(zone_from,zone_to, - Locate_string,Find_string,Avoid_String) return method FilterLine(xline) private returns boolean /***************************************************************************/ /* relevant File Attributes */ /* FileFilter = boolean 0 ** 1 if File has defined Filter */ /* FileZoneFrom = int 0 ** Zone from (char position), 0= no Zone */ /* FileZoneTo = int 0 ** Zone to (char position) */ /* ** <=0: up to end of line */ /* FileLocateString = Rexx Null ** Location Strig, when given (like EXECIO)*/ /* FileFindString = Rexx Null ** Find String, when given (like EXECIO) */ /* FileAvoidString = Rexx Null ** Avoid String, when given (like EXECIO) */ /***************************************************************************/ if \this.FileFilter then return 0 if FileLocateString \= Null then do len1=length(FileLocateString) if xline.substr(1,len1) \= FileLocateString then return 0 end select when this.FileZoneFrom > 0 then do if this.FileZoneTo > 0 then do this_zone=xline.substr(FileZoneFrom,FileZoneTo - FileZoneFrom + 1 ) end else do this_zone=xline.substr(FileZoneFrom) end end otherwise do this_zone=xline /* whole line is regarded as the zone */ end end if FileFindString \= Null then do len2=FileFindString.length() if this_zone.substr(1,len2) \= FileFindString then return 0 end if FileAvoidString \= Null then do len3=FileAvoidString.length() if this_zone.substr(1,len3) = FileAvoidString then return 0 end /* all Filters passed: Line is qualified */ return 1 method get_directory() public static returns rexx return $directory method finish public /* ?? -- why is that NOT called automatically ???*/ /* must finish be a private method ??? */ closeAllFiles return method type(f=Rexx) public static xf=FD(f); xf.type() return method type(plength=int 24) public this.open() n=0 ReyMsg.info2('Display of File:' this.filename ReyTime.date('N') ReyTime.time('N')) loop while this.lines() > 0 xx=this.linein() say xx -- do NOT put it to the log n=n+1 if n//plength = 0 then do xop=ReyMsg.askfor(' Press any key to continue, enter STOP to Interrupt') /* we should here catch interrupted exception */ /* but PAUSE must somehow return STOP or something */ if xop='STOP' then leave end -- catch InterruptedException ??? -- leave ??? end this.close() return method rename(f1,f2) public static SysCmd.exec('RENAME 'f1,f2) return method EOF(f) public static returns boolean xf=FD(f); if xf.lines() = 0 then return 1 return 0 method EOF() public returns boolean if this.lines() = 0 then return 1 return 0 /************ >>>>>>>>>>>>>>>>>>>>>>>>>>>>> * Code snippet to READ a ZIP/ Jara file >> -- query the filechooser to get user input >> if returnedval = JFileChooser.APPROVE_OPTION then >> do >> zp = fc.getSelectedFile() >> zf = ZipFile( zp ) >> >> ? >> catch IOException >> say "IO Error - problem opening archive" >> end >> >> . >> snip >> ------------------------------------------------------------------------ >> /* Generated from 'ReyFile.nrx' 17 Feb 2010 17:07:19 [v2.05] *//* Options: Binary Crossref Decimal Java Logo Trace2 Verbose3 */package Rey.RT; public class ReyFile extends java.io.File{private static final netrexx.lang.Rexx $01=new netrexx.lang.Rexx(0);private static final netrexx.lang.Rexx $02=netrexx.lang.Rexx.toRexx("file:");private static final netrexx.lang.Rexx $03=netrexx.lang.Rexx.toRexx("log");private static final netrexx.lang.Rexx $04=netrexx.lang.Rexx.toRexx("");private static final netrexx.lang.Rexx $05=new netrexx.lang.Rexx(1);private static final netrexx.lang.Rexx $06=new netrexx.lang.Rexx('.');private static final netrexx.lang.Rexx $07=netrexx.lang.Rexx.toRexx(".txt");private static final netrexx.lang.Rexx $08=netrexx.lang.Rexx.toRexx("CLOSE");private static final char[] $09={1,10,2,0,1,0};private static final netrexx.lang.Rexx $010=netrexx.lang.Rexx.toRexx("INPUT");private static final netrexx.lang.Rexx $011=new netrexx.lang.Rexx('r');private static final netrexx.lang.Rexx $012=netrexx.lang.Rexx.toRexx("UPDATE");private static final netrexx.lang.Rexx $013=netrexx.lang.Rexx.toRexx("status:");private static final netrexx.lang.Rexx $014=netrexx.lang.Rexx.toRexx("File:");private static final netrexx.lang.Rexx $015=netrexx.lang.Rexx.toRexx("cannot");private static final netrexx.lang.Rexx $016=netrexx.lang.Rexx.toRexx("Exception:");private static final netrexx.lang.Rexx $017=netrexx.lang.Rexx.toRexx("out:");private static final netrexx.lang.Rexx $018=new netrexx.lang.Rexx(':');private static final netrexx.lang.Rexx $019=netrexx.lang.Rexx.toRexx("to File:");private static final netrexx.lang.Rexx $020=new netrexx.lang.Rexx('\000');private static final netrexx.lang.Rexx $021=netrexx.lang.Rexx.toRexx("loc:");private static final netrexx.lang.Rexx $022=netrexx.lang.Rexx.toRexx("charout:");private static final netrexx.lang.Rexx $023=netrexx.lang.Rexx.toRexx("deleted");private static final netrexx.lang.Rexx $024=netrexx.lang.Rexx.toRexx("***");private static final netrexx.lang.Rexx $025=netrexx.lang.Rexx.toRexx("File: ");private static final netrexx.lang.Rexx $026=netrexx.lang.Rexx.toRexx("ignored");private static final netrexx.lang.Rexx $027=netrexx.lang.Rexx.toRexx("Status:");private static final netrexx.lang.Rexx $028=netrexx.lang.Rexx.toRexx("closed.");private static final netrexx.lang.Rexx $029=netrexx.lang.Rexx.toRexx("exception:");private static final netrexx.lang.Rexx $030=netrexx.lang.Rexx.toRexx("ALL");private static final netrexx.lang.Rexx $031=netrexx.lang.Rexx.toRexx("Stop");private static final netrexx.lang.Rexx $032=netrexx.lang.Rexx.toRexx("line ");private static final netrexx.lang.Rexx $033=netrexx.lang.Rexx.toRexx("alloc FIL:");private static final netrexx.lang.Rexx $034=netrexx.lang.Rexx.toRexx("DSN:");private static final netrexx.lang.Rexx $035=netrexx.lang.Rexx.toRexx("options:");private static final netrexx.lang.Rexx $036=netrexx.lang.Rexx.toRexx("free FIL:");private static final netrexx.lang.Rexx $037=new netrexx.lang.Rexx('-');private static final netrexx.lang.Rexx $038=netrexx.lang.Rexx.toRexx("FileID(");private static final netrexx.lang.Rexx $039=new netrexx.lang.Rexx(',');private static final netrexx.lang.Rexx $040=netrexx.lang.Rexx.toRexx(") returns:");private static final netrexx.lang.Rexx $041=netrexx.lang.Rexx.toRexx("parsefid(");private static final netrexx.lang.Rexx $042=new netrexx.lang.Rexx(2);private static final netrexx.lang.Rexx $043=netrexx.lang.Rexx.toRexx("Unpack:");private static final char[] $044={2,1,59,10,1,0,1,10,1,1,0};private static final netrexx.lang.Rexx $045=netrexx.lang.Rexx.toRexx("stream:");private static final netrexx.lang.Rexx $046=netrexx.lang.Rexx.toRexx("command:");private static final netrexx.lang.Rexx $047=netrexx.lang.Rexx.toRexx("cmd:");private static final netrexx.lang.Rexx $048=netrexx.lang.Rexx.toRexx("on stream:");private static final netrexx.lang.Rexx $049=netrexx.lang.Rexx.toRexx("requested.");private static final netrexx.lang.Rexx $050=netrexx.lang.Rexx.toRexx("bytes");private static final netrexx.lang.Rexx $051=netrexx.lang.Rexx.toRexx("has DTS:");private static final netrexx.lang.Rexx $052=new netrexx.lang.Rexx(')');private static final char[] $053={6,1,10,1,0,1,10,1,2,0};private static final char[] $054={2,1,45,10,1,0,2,1,45,10,1,1,2,1,32,10,1,2,1,10,2,3,4,0};private static final netrexx.lang.Rexx $055=new netrexx.lang.Rexx('/');private static final netrexx.lang.Rexx $056=netrexx.lang.Rexx.toRexx("into core");private static final netrexx.lang.Rexx $057=netrexx.lang.Rexx.toRexx("to:");private static final netrexx.lang.Rexx $058=new netrexx.lang.Rexx('(');private static final netrexx.lang.Rexx $059=netrexx.lang.Rexx.toRexx("bytes)");private static final netrexx.lang.Rexx $060=netrexx.lang.Rexx.toRexx("copied to:");private static final netrexx.lang.Rexx $061=netrexx.lang.Rexx.toRexx("moved to:");private static final char[] $062={6,1,10,1,0,6,3,10,1,2,1,10,1,4,0};private static final char[] $063={6,0,6,0,10,1,1,1,10,1,2,0};private static final netrexx.lang.Rexx $064=netrexx.lang.Rexx.toRexx("Rey");private static final netrexx.lang.Rexx $065=netrexx.lang.Rexx.toRexx("ReyR.jar");private static final netrexx.lang.Rexx $066=netrexx.lang.Rexx.toRexx("ReyC.jar");private static final netrexx.lang.Rexx $067=netrexx.lang.Rexx.toRexx("*.*");private static final netrexx.lang.Rexx $068=netrexx.lang.Rexx.toRexx("STOP");private static final netrexx.lang.Rexx $069=netrexx.lang.Rexx.toRexx("RENAME ");private static final java.lang.String $0="ReyFile.nrx"; /* properties private static */ private static netrexx.lang.Rexx version=netrexx.lang.Rexx.toRexx("7.00"); private static int debug=Rey.RT.Options.opt_debug; private static int trace_io=0; private static int n_files=0; private static int m_files=3000; private static int file_no=0; private static Rey.RT.ReyFile FileTable[]=new Rey.RT.ReyFile[m_files+1]; private static netrexx.lang.Rexx FileNos=new netrexx.lang.Rexx(0); private static Rey.RT.ReyFile CurFile=(Rey.RT.ReyFile)null; private static int chunk_size=10240; private static byte SEQUENTIAL=1; private static byte RANDOM=2; private static java.lang.String System_name="Rey"; /* properties public static */ public static java.util.Properties $props=java.lang.System.getProperties(); public static java.lang.String $classpath=$props.getProperty("java.class.path"); public static java.lang.String $path=$props.getProperty("java.library.path"); public static java.lang.String $ds=":"; public static java.lang.String $fs=$props.getProperty("file.separator"); public static java.lang.String $ts="."; public static java.lang.String $ps=$props.getProperty("path.separator"); public static java.lang.String $ls=$props.getProperty("line.separator"); public static int $ls_length=$ls.length(); public static java.lang.String $user=$props.getProperty("user.name"); public static java.lang.String $directory=$props.getProperty("user.dir"); public static netrexx.lang.Rexx ready=netrexx.lang.Rexx.toRexx("READY:"); public static netrexx.lang.Rexx $EOFChar=netrexx.lang.Rexx.toRexx("001A").x2c(); public static java.lang.String ReyHome=$props.getProperty("ReyHome"); /* properties public */ public int FileNo=0; public java.io.File FileFile=(java.io.File)null; public netrexx.lang.Rexx FileName=netrexx.lang.Rexx.toRexx(""); public netrexx.lang.Rexx FileFullName=netrexx.lang.Rexx.toRexx(""); public netrexx.lang.Rexx FileAccess=netrexx.lang.Rexx.toRexx(""); public byte FileMode=0; public byte FileStatus=0; public byte FileOrganisation=0; public char FileRecType='V'; public int FileRecLen=0; public netrexx.lang.Rexx FileDTS=netrexx.lang.Rexx.toRexx(""); public boolean existing=false; public netrexx.lang.Rexx CurLine=netrexx.lang.Rexx.toRexx(""); public int CurLineNo=0; public boolean PendingLine=false; public boolean ReaDAhead=false; public boolean needsUTF=false; public long FileSize=(long)-1; public int FileNumberOfLines=-1; public boolean FileLinesBuffered=false; public netrexx.lang.Rexx FileLines=netrexx.lang.Rexx.toRexx(""); public long FileReadLocation=(long)1; public long FileWriteLocation=(long)1; public boolean FileFilter=false; public int FileZoneFrom=0; public int FileZoneTo=0; public netrexx.lang.Rexx FileLocateString=(netrexx.lang.Rexx)null; public netrexx.lang.Rexx FileFindString=(netrexx.lang.Rexx)null; public netrexx.lang.Rexx FileAvoidString=(netrexx.lang.Rexx)null; /* properties private */ private netrexx.lang.Rexx FileLowerName=netrexx.lang.Rexx.toRexx(""); private int PriorFileNo=0; private java.io.FileInputStream AttachedFIS=(java.io.FileInputStream)null; private java.io.BufferedInputStream AttachedBIS=(java.io.BufferedInputStream)null; private java.io.DataInputStream AttachedDIS=(java.io.DataInputStream)null; private java.io.FileOutputStream AttachedFOS=(java.io.FileOutputStream)null; private java.io.BufferedOutputStream AttachedBOS=(java.io.BufferedOutputStream)null; private java.io.DataOutputStream AttachedDOS=(java.io.DataOutputStream)null; private java.io.RandomAccessFile AttachedRAF=(java.io.RandomAccessFile)null; private void init(){ Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("ReyHome is:"+" "+ReyHome)); return;} public static netrexx.lang.Rexx get_version(){ return version;} public ReyFile(netrexx.lang.Rexx name){ super(netrexx.lang.Rexx.toString(name));netrexx.lang.Rexx lower_name;netrexx.lang.Rexx old_file_no;Rey.RT.ReyFile old_FD=null;int file_no1=0; lower_name=name.lower(); old_file_no=FileNos.getnode(lower_name).leaf; if (old_file_no.OpGt(null,$01)) { Rey.RT.ReyMsg.warning((($02.OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("already attached to file-no:"))).OpCcblank(null,old_file_no)); old_FD=FileTable[old_file_no.toint()]; Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(" Full name is:").OpCcblank(null,old_FD.FileFullName)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(" please revise program!")); } file_no=0; {int $1=m_files;file_no1=1;file_no1:for(;file_no1<=$1;file_no1++){ if ((file_no1>n_files)|(FileTable[file_no1]==null)) { file_no=file_no1; break file_no1; } }}/*file_no1*/ if (file_no==0) Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("too many files open, max.="+m_files)); if (file_no>n_files) n_files=file_no; FileTable[file_no]=this; this.FileNo=file_no; this.FileName=name; this.FileFile=new java.io.File(netrexx.lang.Rexx.toString(name)); this.existing=this.FileFile.exists(); if (this.existing) { this.FileFullName=netrexx.lang.Rexx.toRexx(FileFile.getAbsolutePath()); this.FileSize=this.FileFile.length(); this.FileStatus=(byte)0; this.FileDTS=DTS(FileName); } else { this.FileFullName=FileName; this.FileSize=0; this.FileStatus=(byte)0; this.FileDTS=new netrexx.lang.Rexx((byte)0); } FileLowerName=lower_name; FileNos.getnode(lower_name).leaf=new netrexx.lang.Rexx(file_no); PriorFileNo=old_file_no.toint(); CurFile=this; if (trace_io!=0) { if ((filetype(name)).OpNotEq(null,$03)&name.OpNotEq(null,$04)) Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("TraceIO ReyFile: File:").OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("attached to file_no:"))).OpCcblank(null,new netrexx.lang.Rexx(file_no))); } return;} public static int ReyFileNo(netrexx.lang.Rexx name){ return (FileNos.getnode(name.lower()).leaf).toint();} public static Rey.RT.ReyFile FD(){ return FD(netrexx.lang.Rexx.toRexx(""));}public static Rey.RT.ReyFile FD(netrexx.lang.Rexx name){netrexx.lang.Rexx iparen;netrexx.lang.Rexx xname1=null;netrexx.lang.Rexx xname2=null;netrexx.lang.Rexx xname=null; iparen=name.pos(new netrexx.lang.Rexx('(')); if (iparen.OpGt(null,$01)) { xname1=name.substr(new netrexx.lang.Rexx((byte)1),iparen.OpSub(null,$05)); xname2=name.substr(iparen.OpAdd(null,$05)).strip(new netrexx.lang.Rexx('T'),new netrexx.lang.Rexx(')')); xname=((xname1.OpCc(null,$06)).OpCc(null,xname2)).OpCc(null,$07); Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("MVS File-name:").OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("simulated by:"))).OpCcblank(null,xname)); name=xname; } if (CurFile!=null) { if (name.OpEq(null,CurFile.FileName)) { file_no=CurFile.FileNo; return CurFile; } } file_no=ReyFileNo(name); if (file_no>0) { CurFile=FileTable[file_no]; if (CurFile==null) CurFile=new Rey.RT.ReyFile(name); } else { CurFile=new Rey.RT.ReyFile(name); file_no=CurFile.FileNo; } return CurFile;} public final Rey.RT.ReyFile access(netrexx.lang.Rexx access_method){java.io.File Fx;netrexx.lang.Rexx access_meth=null;netrexx.lang.Rexx access_options=null;java.lang.String RAFMode=null;boolean append_mode=false;java.io.FileNotFoundException e1=null;java.io.IOException e2=null; if (this.FileName.OpEq(null,$04)) return FileTable[0]; Fx=this.FileFile; {try{accessing:do{ if ((access_method==null)||access_method.OpEq(null,$04)) access_method=netrexx.lang.Rexx.toRexx("INPUT"); if ((((this.FileStatus>0)|(this.FileStatus==(-1))))&access_method.OpNotEq(null,$08)) { this.close(); } if (trace_io!=0) Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("File No:"+" "+this.FileNo+" "+"Name:").OpCcblank(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("access method="))).OpCcblank(null,access_method)); {netrexx.lang.Rexx $2[]=new netrexx.lang.Rexx[2];netrexx.lang.RexxParse.parse(access_method.upper(),$09,$2);access_meth=$2[0];access_options=$2[1];} if ((access_options.wordpos(netrexx.lang.Rexx.toRexx("RANDOM"))).OpGt(null,$01)) { if (access_meth.OpEq(null,$010)) RAFMode="r"; else RAFMode="rw"; AttachedRAF=new java.io.RandomAccessFile(FileFile,RAFMode); FileSize=AttachedRAF.length(); FileReadLocation=1; FileWriteLocation=1; if (netrexx.lang.Rexx.toRexx(RAFMode).OpEq(null,$011)) FileStatus=(byte)1; else FileStatus=(byte)3; FileOrganisation=RANDOM; return this; } {/*select*/ if (access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("INPUT"))||access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("READ"))){ if ((Fx.exists()?1:0)==0) { Rey.RT.ReyMsg.abort((netrexx.lang.Rexx.toRexx("Input file: ").OpCc(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist!"))); } if (Fx.canRead()) { FileAccess=netrexx.lang.Rexx.toRexx("INPUT"); AttachedFIS=new java.io.FileInputStream(Fx); AttachedBIS=new java.io.BufferedInputStream((java.io.InputStream)AttachedFIS); AttachedDIS=new java.io.DataInputStream((java.io.InputStream)AttachedBIS); FileStatus=(byte)1; } else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to read file:").OpCcblank(null,FileName)); } else if (access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("OUTPUT"))||access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("REWRITE"))||access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("REPLACE"))){ existing=Fx.exists(); if (((existing?1:0)==0)||(existing&(Fx.canWrite()))) { FileAccess=netrexx.lang.Rexx.toRexx("OUTPUT"); AttachedFOS=new java.io.FileOutputStream(Fx); AttachedBOS=new java.io.BufferedOutputStream((java.io.OutputStream)AttachedFOS); AttachedDOS=new java.io.DataOutputStream((java.io.OutputStream)AttachedBOS); FileStatus=(byte)2; } else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to REWRITE file:").OpCcblank(null,FileName)); } else if (access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("EXTEND"))||access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("APPEND"))||access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("WRITE"))){ existing=Fx.exists(); if (((existing?1:0)==0)||(existing&(Fx.canWrite()))) { FileAccess=netrexx.lang.Rexx.toRexx("EXTEND"); append_mode=true; AttachedFOS=new java.io.FileOutputStream(netrexx.lang.Rexx.toString(this.FileName),append_mode); AttachedBOS=new java.io.BufferedOutputStream((java.io.OutputStream)AttachedFOS); AttachedDOS=new java.io.DataOutputStream((java.io.OutputStream)AttachedBOS); FileStatus=(byte)3; } else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to WRITE/APPEND to file:").OpCcblank(null,FileName)); } else if (access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("UPDATE"))){ if ((Fx.canRead())&(Fx.canWrite())) { FileAccess=netrexx.lang.Rexx.toRexx("UPDATE"); AttachedFIS=new java.io.FileInputStream(Fx); AttachedBIS=new java.io.BufferedInputStream((java.io.InputStream)AttachedFIS); AttachedDIS=new java.io.DataInputStream((java.io.InputStream)AttachedBIS); AttachedFOS=new java.io.FileOutputStream(Fx); AttachedBOS=new java.io.BufferedOutputStream((java.io.OutputStream)AttachedFOS); AttachedDOS=new java.io.DataOutputStream((java.io.OutputStream)AttachedBOS); FileStatus=(byte)4; } else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to UPDATE file:").OpCcblank(null,FileName)); } else if (access_meth.OpEqS(null,netrexx.lang.Rexx.toRexx("CLOSE"))){ this.close(); return this; } else{{ Rey.RT.ReyMsg.abort(((netrexx.lang.Rexx.toRexx("illegal access-method:").OpCcblank(null,access_method)).OpCcblank(null,netrexx.lang.Rexx.toRexx("specified for file:"))).OpCcblank(null,FileName)); }} } if ((access_options.wordpos(netrexx.lang.Rexx.toRexx("UTF"))).OpGt(null,$01)) this.needsUTF=true; if ((access_options.wordpos(netrexx.lang.Rexx.toRexx("LINES"))).OpGt(null,$01)) { if (FileAccess.OpEq(null,$010)|FileAccess.OpEq(null,$012)) this.load_lines(); FileLinesBuffered=true; } if (trace_io!=0) netrexx.lang.RexxIO.Say((((($02.OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("opened for:"))).OpCcblank(null,FileAccess)).OpCcblank(null,$013)).OpCcblank(null,new netrexx.lang.Rexx(FileStatus)));}while(false);} catch (java.io.FileNotFoundException $3){e1=$3; Rey.RT.ReyMsg.abort((($014.OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist, cannot:"))).OpCcblank(null,access_method));} catch (java.io.IOException $4){e2=$4; Rey.RT.ReyMsg.abort((((($015.OpCcblank(null,access_method)).OpCcblank(null,$014)).OpCcblank(null,FileName)).OpCcblank(null,$016)).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e2)))); }}/*accessing*/ return this;} public final int lineout(netrexx.lang.Rexx oline){java.io.IOException e=null; if (oline==null) return 0; {try{put_line:do{ if (oline==null) oline=netrexx.lang.Rexx.toRexx(""); if (((this==null)||(this.FileName==null))||this.FileName.OpEq(null,$04)) { Rey.RT.ReyMsg.info(oline); return 0; } if (FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("WRITE")); CurLineNo++; CurLine=oline; if (trace_io==3) Rey.RT.ReyMsg.info((((($02.OpCcblank(null,this.FileName)).OpCcblank(null,$017)).OpCcblank(null,new netrexx.lang.Rexx(CurLineNo))).OpCc(null,$018)).OpCc(null,CurLine)); {/*select*/ if (this.FileLinesBuffered){ FileLines.getnode(new netrexx.lang.Rexx(CurLineNo)).leaf=CurLine; if (CurLineNo>FileNumberOfLines) FileNumberOfLines=CurLineNo; } else if (this.needsUTF){ AttachedDOS.writeUTF(netrexx.lang.Rexx.toString(oline)); AttachedDOS.writeUTF($ls); } else{{ AttachedDOS.writeBytes(netrexx.lang.Rexx.toString(oline)); AttachedDOS.writeBytes($ls); }} } FileWriteLocation=new netrexx.lang.Rexx(FileWriteLocation).OpAdd(null,oline.length()).OpAdd(null,new netrexx.lang.Rexx($ls_length)).tolong(); FileSize=max(FileSize,FileWriteLocation-1);}while(false);} catch (java.io.IOException $5){e=$5; Rey.RT.ReyMsg.abort(((((netrexx.lang.Rexx.toRexx("cannot write line:").OpCcblank(null,oline)).OpCcblank(null,$019)).OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("IO-Exception:"))).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); }}/*put_line*/ return 0;} public final int lineout(netrexx.lang.Rexx oline,int oline_no){ if (FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("WRITE LINES")); CurLineNo=oline_no-1; if ((oline==null)||oline.OpEqS(null,$04)) return 0; return lineout(oline);} public static int lineout(netrexx.lang.Rexx f,netrexx.lang.Rexx oline){ if (oline==null) oline=netrexx.lang.Rexx.toRexx(""); if ((f==null)||f.OpEq(null,$04)) { Rey.RT.ReyMsg.info(oline); return 0; } return FD(f).lineout(oline);} public final int charout(netrexx.lang.Rexx text){java.io.IOException e=null; if (((this==null)||(this.FileName==null))||this.FileName.OpEq(null,$04)) { Rey.RT.ReyMsg.info(text.OpCc(null,$020)); return 0; } if (this.FileStatus<2) this.extend(); if (trace_io==3) Rey.RT.ReyMsg.info((((($02.OpCcblank(null,this.FileName)).OpCcblank(null,$021)).OpCcblank(null,new netrexx.lang.Rexx(FileWriteLocation))).OpCcblank(null,$022)).OpCcblank(null,text)); {try{write_pending_stuff:do{ {/*select*/ if (FileOrganisation==RANDOM)AttachedRAF.writeBytes(netrexx.lang.Rexx.toString(text)); else if (this.needsUTF)AttachedDOS.writeUTF(netrexx.lang.Rexx.toString(text)); else{AttachedDOS.writeBytes(netrexx.lang.Rexx.toString(text));} }}while(false);} catch (java.io.IOException $6){e=$6; Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("unable to write:").OpCcblank(null,text)).OpCcblank(null,$019)).OpCcblank(null,FileName)); Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("Fatal I/O Exception:"+" "+e.toString())); }}/*write_pending_stuff*/ FileWriteLocation=new netrexx.lang.Rexx(FileWriteLocation).OpAdd(null,text.length()).tolong(); FileSize=max(FileWriteLocation-1,FileSize); return 0;} public final int charout(netrexx.lang.Rexx text,long start){ if (start!=FileWriteLocation) this.SeekTo(start); this.charout(text); return 0;} public static int charout(netrexx.lang.Rexx f,netrexx.lang.Rexx text){ return FD(f).charout(text);} public static int charout(netrexx.lang.Rexx f,netrexx.lang.Rexx text,long start){ return FD(f).charout(text,start);} public static void traceio(){ traceio(1);return;}public static void traceio(int itrace){ trace_io=itrace; return;} public netrexx.lang.Rexx open(){ return open(netrexx.lang.Rexx.toRexx(""));}public netrexx.lang.Rexx open(netrexx.lang.Rexx access_method){Rey.RT.ReyFile xf; xf=this.access(access_method); return ready;} public static netrexx.lang.Rexx open(netrexx.lang.Rexx f,netrexx.lang.Rexx access_method){Rey.RT.ReyFile xf; xf=FD(f);xf.access(access_method); return ready;} public static netrexx.lang.Rexx read(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);xf.access(netrexx.lang.Rexx.toRexx("INPUT")); return ready;} public boolean exists(){ return FileFile.exists();} public static boolean exists(netrexx.lang.Rexx f){ return (new java.io.File(netrexx.lang.Rexx.toString(f))).exists();} public final netrexx.lang.Rexx scratch(){boolean deleted; if (trace_io!=0) Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("scratching file: ").OpCc(null,this.FileName)); deleted=false; if (this.FileFile.exists()) deleted=this.FileFile.delete(); else deleted=true; if (deleted&(trace_io!=0)) Rey.RT.ReyMsg.info(($014.OpCcblank(null,this.FileName)).OpCcblank(null,$023)); if ((deleted?1:0)==0) Rey.RT.ReyMsg.info((netrexx.lang.Rexx.toRexx("*** unable to delete file: ").OpCc(null,this.FileName)).OpCcblank(null,$024)); access(netrexx.lang.Rexx.toRexx("OUTPUT")); return ready;} public static netrexx.lang.Rexx scratch(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);xf.scratch(); return ready;} public static netrexx.lang.Rexx delete(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);xf.scratch(); return ready;} public final netrexx.lang.Rexx extend(){ if ((this.FileFile.exists()?1:0)==0) return this.scratch(); this.access(netrexx.lang.Rexx.toRexx("EXTEND")); return ready;} public static netrexx.lang.Rexx extend(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);xf.extend(); return ready;} public final netrexx.lang.Rexx close(){java.io.IOException e=null; {try{closing:do{ if (FileStatus==0) break closing; if (FileStatus==(-2)) { if (trace_io!=0) { Rey.RT.ReyMsg.warning((($025.OpCc(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("already closed, CLOSE"))).OpCcblank(null,$026)); Rey.RT.ReyMsg.info(((($014.OpCcblank(null,this.FileName)).OpCcblank(null,$027)).OpCcblank(null,new netrexx.lang.Rexx(this.FileStatus))).OpCcblank(null,netrexx.lang.Rexx.toRexx("(-2 = already closed)"))); } break closing; } if (AttachedDIS!=null) { AttachedDIS.close(); AttachedDIS=(java.io.DataInputStream)null; AttachedBIS.close(); AttachedBIS=(java.io.BufferedInputStream)null; AttachedFIS.close(); AttachedFIS=(java.io.FileInputStream)null; } if (AttachedDOS!=null) { if (FileLinesBuffered) save_lines(); AttachedDOS.flush(); AttachedDOS.close(); AttachedBOS.flush(); AttachedFOS.flush(); AttachedFOS.close(); AttachedFOS=(java.io.FileOutputStream)null;AttachedBOS=(java.io.BufferedOutputStream)null;AttachedDOS=(java.io.DataOutputStream)null; } if (AttachedRAF!=null) { AttachedRAF.close(); AttachedRAF=(java.io.RandomAccessFile)null; } if ((trace_io!=0)&!this.equals(Rey.RT.ReyMsg.FD_LogFile)) Rey.RT.ReyMsg.info(($025.OpCcblank(null,FileName)).OpCcblank(null,$028));}while(false);} catch (java.io.IOException $7){e=$7; Rey.RT.ReyMsg.warning(((netrexx.lang.Rexx.toRexx("unable to close file: ").OpCc(null,FileName)).OpCcblank(null,$029)).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("processing continues ...")); }}/*closing*/ file_no=this.FileNo; FileNos.getnode(this.FileLowerName).leaf=new netrexx.lang.Rexx((byte)0); FileTable[file_no]=(Rey.RT.ReyFile)null; CurFile=(Rey.RT.ReyFile)null; file_no=0; this.FileNo=0; this.FileStatus=(byte)-2; this.FileReadLocation=1; this.FileWriteLocation=1; this.FileSize=this.FileFile.length(); return ready;} public static netrexx.lang.Rexx close(netrexx.lang.Rexx f){Rey.RT.ReyFile FD_object;netrexx.lang.Rexx xf; if (f.OpEq(null,$030)|f.OpEq(null,$04)) { closeAllFiles(); return ready; } FD_object=FD(f); xf=FD_object.close(); FD_object=(Rey.RT.ReyFile)null; return ready;} public void flush() throws java.io.IOException{ if (AttachedDOS!=null) { if (FileLinesBuffered) save_lines(); AttachedDOS.flush(); AttachedBOS.flush(); AttachedFOS.flush(); } return;} public void finalize(){ if ((this.FileStatus!=(-2))&(this.FileStatus!=0)) this.close(); return;} public static void closeAllFiles(){int ii=0;netrexx.lang.Rexx name=null; {int $8=n_files;ii=1;ii:for(;ii<=$8;ii++){ CurFile=FileTable[ii]; if (CurFile==null) continue ii; name=CurFile.FileName; if (CurFile.equals(Rey.RT.ReyMsg.FD_LogFile)) continue ii; if ((CurFile.FileStatus!=0)&(CurFile.FileStatus!=(-2))) { CurFile.close(); } FileTable[ii]=(Rey.RT.ReyFile)null; }}/*ii*/ Rey.RT.ReyMsg.closeLog(); file_no=0; n_files=0; return;} public void lineout(){ if (this==null) return; close();return;} public void charout(){ if (this==null) return; close();return;} public final netrexx.lang.Rexx linein(){java.io.IOException e=null; if (PendingLine) { Rey.RT.ReyMsg.FD_infile=this.FD(); Rey.RT.ReyMsg.infile=this.FileName; Rey.RT.ReyMsg.line=this.CurLine; Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); Rey.RT.ReyMsg.line_no=this.CurLineNo; PendingLine=false; return CurLine; } {reading_line:for(;;){ if (AttachedFIS==null) { CurLine=Rey.RT.ReyMsg.askfor(netrexx.lang.Rexx.toRexx("Cmd>")); if (CurLine==null) CurLine=netrexx.lang.Rexx.toRexx("Stop"); if (CurLine.OpEq(null,$031)) { CurLineNo=0; Rey.RT.ReyMsg.line=(netrexx.lang.Rexx)null; Rey.RT.ReyMsg.line_no=0; return (netrexx.lang.Rexx)null; } return CurLine; } if (this.FileStatus==(-1)) { Rey.RT.ReyMsg.warning(($025.OpCc(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("reading past EOF!"))); return (netrexx.lang.Rexx)null; } if (this.FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("INPUT")); CurLineNo++; if (FileLinesBuffered) { CurLine=FileLines.getnode(new netrexx.lang.Rexx(CurLineNo)).leaf; } else {try{reading:do{ CurLine=netrexx.lang.Rexx.toRexx(AttachedDIS.readLine());}while(false);} catch (java.io.IOException $9){e=$9; Rey.RT.ReyMsg.abort((((($025.OpCc(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("can not read line:"))).OpCcblank(null,new netrexx.lang.Rexx(CurLineNo))).OpCcblank(null,netrexx.lang.Rexx.toRexx("IOException:"))).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); }}/*reading*/ if (CurLine!=null) { if ((CurLine.substr(new netrexx.lang.Rexx((byte)1),new netrexx.lang.Rexx((byte)1))).OpEq(null,$EOFChar)) { CurLine=(netrexx.lang.Rexx)null; } } if ((!this.ReaDAhead)) { if (CurLine==null) { Rey.RT.ReyMsg.line=(netrexx.lang.Rexx)null; Rey.RT.ReyMsg.line_no=0; Rey.RT.ReyMsg.line_len=0; } else { Rey.RT.ReyMsg.FD_infile=CurFile; Rey.RT.ReyMsg.infile=this.FileName; Rey.RT.ReyMsg.line=this.CurLine; Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); Rey.RT.ReyMsg.line_no=this.CurLineNo; } if (FileFilter) { if ((!(FilterLine(CurLine)))) continue reading_line; } } if (CurLine==null) { FileStatus=(byte)-1; PendingLine=false; if (new netrexx.lang.Rexx(debug).toboolean()) Rey.RT.ReyMsg.debug(netrexx.lang.Rexx.toRexx(java.lang.String.valueOf(CurLineNo)+" "+": -EOF-")); return CurLine; } if ((trace_io==2)&(CurLine!=null)) Rey.RT.ReyMsg.info((((($014.OpCcblank(null,FileName)).OpCcblank(null,$032)).OpCcblank(null,new netrexx.lang.Rexx(CurLineNo))).OpCcblank(null,$018)).OpCcblank(null,CurLine)); return CurLine; }}/*reading_line*/} public netrexx.lang.Rexx linein(int line_no){ return linein(line_no,1);}public netrexx.lang.Rexx linein(int line_no,int count){ if ((this.FileStatus>0)&((FileLinesBuffered?1:0)==0)) { Rey.RT.ReyMsg.error((netrexx.lang.Rexx.toRexx("RANDOM access line numbered file:").OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("not opened properly"))); this.close(); } if (FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("READ LINES")); if ((FileLinesBuffered?1:0)==0) this.load_lines(); if (line_no>FileNumberOfLines) { Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("reading past end of File:").OpCcblank(null,FileName)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("Line: "+line_no+" "+"not present in File:").OpCcblank(null,FileName)); } CurLineNo=line_no-1; if (count==0) return (netrexx.lang.Rexx)null; return linein();} public static netrexx.lang.Rexx linein(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);return xf.linein();} public static netrexx.lang.Rexx linein(netrexx.lang.Rexx f,int line_no){ return linein(f,line_no,1);}public static netrexx.lang.Rexx linein(netrexx.lang.Rexx f,int line_no,int count){Rey.RT.ReyFile xf; xf=FD(f);return xf.linein(line_no,count);} public final int lines(){ {read_ahead:do{ if (((this==null)||(this.FileName==null))||this.FileName.OpEq(null,$04)) return 1; if (this.FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("INPUT")); if (this.FileStatus<0) return 0; if (FileLinesBuffered) return FileNumberOfLines-CurLineNo; if (PendingLine) return 1; this.ReaDAhead=true; this.linein(); this.ReaDAhead=false; PendingLine=true; if (CurLine==null) { FileStatus=(byte)-1; PendingLine=false; return 0; } return 1;}while(false); }/*read_ahead*/} public static boolean lines(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);return new netrexx.lang.Rexx(xf.lines()).toboolean();} public static netrexx.lang.Rexx linesin(netrexx.lang.Rexx f,netrexx.lang.Rexx n){Rey.RT.ReyFile xf; xf=FD(f);return xf.linesin(n.toint());} public netrexx.lang.Rexx linesin(int n){netrexx.lang.Rexx stem;int n1; stem=netrexx.lang.Rexx.toRexx(""); n1=0; {$10:for(;;){ if ((this.lines())==0) break $10; n1++; stem.getnode(new netrexx.lang.Rexx(n1)).leaf=this.linein(); if ((n>=0)&(n1>=n)) break $10; }} stem.getnode(new netrexx.lang.Rexx((byte)0)).leaf=new netrexx.lang.Rexx(n1); return stem;} public static void linesout(netrexx.lang.Rexx f,netrexx.lang.Rexx stem) throws java.io.IOException{Rey.RT.ReyFile xf; xf=FD(f);xf.linesout(stem); xf.flush(); return;} public void linesout(netrexx.lang.Rexx stem){int n1;int i; n1=(stem.getnode(new netrexx.lang.Rexx((byte)0)).leaf).toint(); i=0; {int $11=n1;i=1;i:for(;i<=$11;i++){ this.lineout(stem.getnode(new netrexx.lang.Rexx(i)).leaf); }}/*i*/ return;} public static Rey.RT.ReyFile alloc(netrexx.lang.Rexx FIL,netrexx.lang.Rexx DSN){ return alloc(FIL,DSN,netrexx.lang.Rexx.toRexx(""));}public static Rey.RT.ReyFile alloc(netrexx.lang.Rexx FIL,netrexx.lang.Rexx DSN,netrexx.lang.Rexx opts){ Rey.RT.ReyMsg.info((((($033.OpCcblank(null,FIL)).OpCcblank(null,$034)).OpCcblank(null,DSN)).OpCcblank(null,$035)).OpCcblank(null,opts)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("-- not yet implemented --")); return (Rey.RT.ReyFile)null;} public static Rey.RT.ReyFile free(netrexx.lang.Rexx FIL){ return free(FIL,netrexx.lang.Rexx.toRexx(""));}public static Rey.RT.ReyFile free(netrexx.lang.Rexx FIL,netrexx.lang.Rexx opts){ Rey.RT.ReyMsg.info($036.OpCcblank(null,FIL)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("-- not yet implemented --")); return (Rey.RT.ReyFile)null;} public static netrexx.lang.Rexx fileid(netrexx.lang.Rexx fn){ return fileid(fn,netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx fileid(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft){ return fileid(fn,ft,netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx fileid(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft,netrexx.lang.Rexx fp){ return fileid(fn,ft,fp,netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx fileid(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft,netrexx.lang.Rexx fp,netrexx.lang.Rexx fd){netrexx.lang.Rexx fx=null;netrexx.lang.Rexx len=null; if (ft.OpEq(null,$037)) ft=netrexx.lang.Rexx.toRexx(""); if (ft.OpNotEq(null,$04)) fx=(fn.OpCc(null,netrexx.lang.Rexx.toRexx($ts))).OpCc(null,ft); else fx=fn; if (fp.OpNotEq(null,$04)) { len=fp.length(); if ((fp.substr(len,new netrexx.lang.Rexx((byte)1))).OpEq(null,netrexx.lang.Rexx.toRexx($fs))) fx=fp.OpCc(null,fx); else fx=(fp.OpCc(null,netrexx.lang.Rexx.toRexx($fs))).OpCc(null,fx); } if (fd.OpNotEq(null,$04)) fx=(fd.OpCc(null,$018)).OpCc(null,fx); if (trace_io>=4) Rey.RT.ReyMsg.info((((((((($038.OpCc(null,fn)).OpCc(null,$039)).OpCc(null,ft)).OpCc(null,$039)).OpCc(null,fp)).OpCc(null,$039)).OpCc(null,fd)).OpCc(null,$040)).OpCcblank(null,fx)); return fx;} public static netrexx.lang.Rexx workfile(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft){ return workfile(fn,ft,netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx workfile(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft,netrexx.lang.Rexx fp){ return fileid(fn,ft,fp);} public static netrexx.lang.Rexx parsefid(netrexx.lang.Rexx fid){netrexx.lang.Rexx ic_ft;netrexx.lang.Rexx fn=null;netrexx.lang.Rexx ft=null;netrexx.lang.Rexx ic_fs;netrexx.lang.Rexx fp=null; ic_ft=fid.lastpos(netrexx.lang.Rexx.toRexx($ts)); if (ic_ft.OpGt(null,$01)) { fn=fid.substr(new netrexx.lang.Rexx((byte)1),ic_ft.OpSub(null,$05)); ft=fid.substr(ic_ft.OpAdd(null,$05),(fid.length()).OpSub(null,ic_ft)); } else { fn=fid;ft=netrexx.lang.Rexx.toRexx(""); } ic_fs=fn.lastpos(netrexx.lang.Rexx.toRexx($fs)); if (ic_fs.OpGt(null,$01)) { fp=fn.substr(new netrexx.lang.Rexx((byte)1),ic_fs.OpSub(null,$05)); fn=fn.substr(ic_fs.OpAdd(null,$05),(fn.length()).OpSub(null,ic_fs)); } else fp=netrexx.lang.Rexx.toRexx(""); if (trace_io==4) Rey.RT.ReyMsg.info((((($041.OpCc(null,fid)).OpCc(null,netrexx.lang.Rexx.toRexx(") returns: "))).OpCcblank(null,fn)).OpCcblank(null,ft)).OpCcblank(null,fp)); if (fp.OpNotEq(null,$04)&ft.OpEq(null,$04)) ft=new netrexx.lang.Rexx('-'); return (fn.OpCcblank(null,ft)).OpCcblank(null,fp);} public static netrexx.lang.Rexx filename(netrexx.lang.Rexx fid){ return parsefid(fid).word(new netrexx.lang.Rexx((byte)1));} public static netrexx.lang.Rexx filetype(netrexx.lang.Rexx fid){netrexx.lang.Rexx xfid;netrexx.lang.Rexx ft=null; xfid=parsefid(fid); if ((xfid.words()).OpGt(null,$05)) { ft=xfid.word(new netrexx.lang.Rexx((byte)2)); if (ft.OpEq(null,$037)) ft=netrexx.lang.Rexx.toRexx(""); return ft; } else return netrexx.lang.Rexx.toRexx("");} public static netrexx.lang.Rexx filepath(netrexx.lang.Rexx fid){netrexx.lang.Rexx xfid; xfid=parsefid(fid); if ((xfid.words()).OpGt(null,$042)) return xfid.word(new netrexx.lang.Rexx((byte)3)); else return netrexx.lang.Rexx.toRexx("");} public static netrexx.lang.Rexx unpack(netrexx.lang.Rexx packed_fid,netrexx.lang.Rexx fid){ Rey.RT.ReyMsg.error(($043.OpCcblank(null,packed_fid)).OpCcblank(null,netrexx.lang.Rexx.toRexx("not available in Java!"))); return ready;} public static netrexx.lang.Rexx fullname(netrexx.lang.Rexx fid){ return netrexx.lang.Rexx.toRexx((new java.io.File(netrexx.lang.Rexx.toString(fid))).getAbsolutePath());} public static boolean ispacked(netrexx.lang.Rexx fid){ return false;} public static boolean isopen(netrexx.lang.Rexx fid){Rey.RT.ReyFile $$$f; $$$f=Rey.RT.ReyFile.FD(fid); if ($$$f.FileStatus>0) return true; else return false;} public static void erase(netrexx.lang.Rexx fid){java.io.File File_fid;boolean deleted;java.lang.String File_Path=null; if (trace_io!=0) Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("deleting(erasing) File:").OpCcblank(null,fid)); file_no=ReyFileNo(fid); if ((file_no>0)&(isopen(fid))) { Rey.RT.ReyMsg.warning(((netrexx.lang.Rexx.toRexx("erase file:").OpCcblank(null,fid)).OpCcblank(null,netrexx.lang.Rexx.toRexx("file is still open,"))).OpCcblank(null,netrexx.lang.Rexx.toRexx("implcit closing activated"))); Rey.RT.ReyFile.close(fid); } File_fid=new java.io.File(netrexx.lang.Rexx.toString(fid)); if ((File_fid.exists()?1:0)==0) return; deleted=File_fid.delete(); if ((deleted?1:0)==0) { Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("unable to delete File:").OpCcblank(null,fid)); File_Path=File_fid.getAbsolutePath(); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("absolute path:"+" "+File_Path)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("ReyFile.FileNo: ").OpCc(null,Rey.RT.ReyFunc.quoted(FileNos.getnode(fid.lower()).leaf))); return; } if ((trace_io!=0)&deleted) Rey.RT.ReyMsg.info(($014.OpCcblank(null,fid)).OpCcblank(null,netrexx.lang.Rexx.toRexx("successfully deleted!"))); return;} public netrexx.lang.Rexx erase(){ this.erase(FileName); return ready;} public static void purge(netrexx.lang.Rexx flist){netrexx.lang.Rexx f=null; {for(;;){if(!flist.OpNotEq(null,$04))break; {netrexx.lang.Rexx $12[]=new netrexx.lang.Rexx[2];netrexx.lang.RexxParse.parse(flist,$044,$12);f=$12[0];flist=$12[1];} if (exists(f)) erase(f); }} return;} public static netrexx.lang.Rexx stream(){ return stream(netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx stream(netrexx.lang.Rexx stream_name){ return stream(stream_name,netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx stream(netrexx.lang.Rexx stream_name,netrexx.lang.Rexx operation){ return stream(stream_name,operation,netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx stream(netrexx.lang.Rexx stream_name,netrexx.lang.Rexx operation,netrexx.lang.Rexx command){netrexx.lang.Rexx cmd=null;netrexx.lang.Rexx access_mode=null;Rey.RT.ReyFile $$$stream; operation=operation.substr(new netrexx.lang.Rexx((byte)1),new netrexx.lang.Rexx((byte)1)).upper(); {netrexx.lang.Rexx $13[]=new netrexx.lang.Rexx[2];netrexx.lang.RexxParse.parse(command.upper(),$09,$13);cmd=$13[0];access_mode=$13[1];} $$$stream=FD(stream_name); {/*select*/ if (operation.OpEqS(null,new netrexx.lang.Rexx('C'))){ {/*select*/ if (cmd.OpEqS(null,netrexx.lang.Rexx.toRexx("OPEN"))||cmd.OpEqS(null,new netrexx.lang.Rexx('O')))$$$stream.access(access_mode); else if (cmd.OpEqS(null,netrexx.lang.Rexx.toRexx("CLOSE"))||cmd.OpEqS(null,new netrexx.lang.Rexx('C')))$$$stream.close(); else if (cmd.OpEqS(null,netrexx.lang.Rexx.toRexx("SEEK"))){ Rey.RT.ReyMsg.warning(((($045.OpCcblank(null,stream_name)).OpCcblank(null,$046)).OpCcblank(null,command)).OpCcblank(null,netrexx.lang.Rexx.toRexx("currently ignored!"))); return new netrexx.lang.Rexx((byte)0); } else{{ Rey.RT.ReyMsg.abort(((($014.OpCcblank(null,stream_name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("illegal comand:"))).OpCcblank(null,command)).OpCcblank(null,netrexx.lang.Rexx.toRexx("encountered!"))); }} } } else if (operation.OpEqS(null,new netrexx.lang.Rexx('Q'))){ Rey.RT.ReyMsg.error((netrexx.lang.Rexx.toRexx("stream QUERY").OpCcblank(null,stream_name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("not yet implemented"))); } else if (operation.OpEqS(null,new netrexx.lang.Rexx('S'))||operation.OpEqS(null,netrexx.lang.Rexx.toRexx(""))){ Rey.RT.ReyMsg.error((netrexx.lang.Rexx.toRexx("stream STATUS").OpCcblank(null,stream_name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("not yet implemented"))); } else{ Rey.RT.ReyMsg.abort((((((netrexx.lang.Rexx.toRexx("illegal operation:").OpCcblank(null,operation)).OpCcblank(null,$047)).OpCcblank(null,command)).OpCcblank(null,$048)).OpCcblank(null,stream_name)).OpCcblank(null,$049));} } return netrexx.lang.Rexx.toRexx("READY:");} public static long length(netrexx.lang.Rexx file){long jlength; if (file.OpEq(null,$04)) return 1; jlength=(new java.io.File(netrexx.lang.Rexx.toString(file))).length(); if (trace_io==4) Rey.RT.ReyMsg.info(((($014.OpCcblank(null,file)).OpCcblank(null,netrexx.lang.Rexx.toRexx("has length:"))).OpCcblank(null,new netrexx.lang.Rexx(jlength))).OpCcblank(null,$050)); return jlength;} public static netrexx.lang.Rexx DTS(){ return Rey.RT.ReyTime.dts();} public static netrexx.lang.Rexx DTS(netrexx.lang.Rexx file){long dlm;java.util.GregorianCalendar cal;int YYYY;netrexx.lang.Rexx MM;netrexx.lang.Rexx DD;netrexx.lang.Rexx hh;netrexx.lang.Rexx nn;netrexx.lang.Rexx ss;netrexx.lang.Rexx nnnn;netrexx.lang.Rexx dts1; if ((!(exists(file)))) return netrexx.lang.Rexx.toRexx(""); dlm=(new java.io.File(netrexx.lang.Rexx.toString(file))).lastModified(); cal=new java.util.GregorianCalendar(); cal.setTime(new java.util.Date(dlm)); YYYY=cal.get(java.util.Calendar.YEAR); MM=(new netrexx.lang.Rexx((cal.get(java.util.Calendar.MONTH))+1)).right(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx('0')); DD=(new netrexx.lang.Rexx(cal.get(java.util.Calendar.DATE))).right(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx('0')); hh=(new netrexx.lang.Rexx(cal.get(java.util.Calendar.HOUR_OF_DAY))).right(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx('0')); nn=(new netrexx.lang.Rexx(cal.get(java.util.Calendar.MINUTE))).right(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx('0')); ss=(new netrexx.lang.Rexx(cal.get(java.util.Calendar.SECOND))).right(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx('0')); nnnn=(new netrexx.lang.Rexx((cal.get(java.util.Calendar.MILLISECOND))*10)).right(new netrexx.lang.Rexx((byte)4),new netrexx.lang.Rexx('0')); dts1=((((((((netrexx.lang.Rexx.toRexx(java.lang.String.valueOf(YYYY)+"-").OpCc(null,MM)).OpCc(null,$037)).OpCc(null,DD)).OpCcblank(null,hh)).OpCc(null,$018)).OpCc(null,nn)).OpCc(null,$018)).OpCc(null,ss)).OpCcblank(null,nnnn); if (trace_io==4) Rey.RT.ReyMsg.info((($014.OpCcblank(null,file)).OpCcblank(null,$051)).OpCcblank(null,dts1)); return dts1;} public final long chars(){ if (this.FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("INPUT")); return (FileSize-FileReadLocation)+1;} public static long chars(netrexx.lang.Rexx file){ return FD(file).chars();} public netrexx.lang.Rexx charin() throws java.io.IOException{ return charin(chunk_size);}public netrexx.lang.Rexx charin(int n) throws java.io.IOException{long m;byte chunk[]=null;java.lang.String chunks=null; if (this.FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("INPUT")); m=chars(); if (m<n) n=(int)m; if (n<=0) return netrexx.lang.Rexx.toRexx(""); {try{read_chunk:do{ chunk=new byte[n]; if (FileOrganisation==RANDOM) AttachedRAF.readFully(chunk); else AttachedDIS.readFully(chunk); FileReadLocation=FileReadLocation+n; chunks=new java.lang.String(chunk); return netrexx.lang.Rexx.toRexx(chunks);}while(false);} catch (java.io.EOFException $14){ Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("unexpected EOF in File:").OpCcblank(null,this.FileName)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("FileSize is .......:"+" "+FileSize)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("FileReadLocation is:"+" "+FileReadLocation)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("attempt to read"+" "+n+" "+"bytes failed with EOFException!")); FileSize=FileReadLocation-1; return netrexx.lang.Rexx.toRexx(""); }}/*read_chunk*/} public netrexx.lang.Rexx charin(long start,int n) throws java.io.IOException{ if (this.FileStatus==0) this.access(netrexx.lang.Rexx.toRexx("READ RANDOM")); if ((start>0)&(FileReadLocation!=start)) SeekTo(start); if (n==0) return (netrexx.lang.Rexx)null; return charin(n);} public static netrexx.lang.Rexx charin(netrexx.lang.Rexx file,long start,int n) throws java.io.IOException{ return FD(file).charin(start,n);} public static netrexx.lang.Rexx filespec(netrexx.lang.Rexx option,netrexx.lang.Rexx spec){netrexx.lang.Rexx opt; opt=option.substr(new netrexx.lang.Rexx((byte)1),new netrexx.lang.Rexx((byte)1)).upper(); {/*select*/ if (opt.OpEqS(null,new netrexx.lang.Rexx('N')))return nametype(spec); else if (opt.OpEqS(null,new netrexx.lang.Rexx('D')))return filedrive(spec); else if (opt.OpEqS(null,new netrexx.lang.Rexx('P')))return filepath(spec); else if (opt.OpEqS(null,new netrexx.lang.Rexx('I')))return filename(spec); else if (opt.OpEqS(null,new netrexx.lang.Rexx('T')))return filetype(spec); else{ Rey.RT.ReyMsg.abort((((netrexx.lang.Rexx.toRexx("unknown option in filespec(").OpCc(null,option)).OpCc(null,$039)).OpCc(null,spec)).OpCc(null,$052)); return new netrexx.lang.Rexx('?');} }} public static netrexx.lang.Rexx nametype(netrexx.lang.Rexx file){netrexx.lang.Rexx name;netrexx.lang.Rexx type; name=filename(file); type=filetype(file); if (type.OpNotEq(null,$04)) return (name.OpCc(null,$06)).OpCc(null,type); else return name;} public static netrexx.lang.Rexx filedrive(netrexx.lang.Rexx file){ if ((file.substr(new netrexx.lang.Rexx((byte)2),new netrexx.lang.Rexx((byte)1))).OpEq(null,$018)) return file.substr(new netrexx.lang.Rexx((byte)1),new netrexx.lang.Rexx((byte)1)); else return netrexx.lang.Rexx.toRexx("");} public static netrexx.lang.Rexx sysfileid(netrexx.lang.Rexx fn){ return sysfileid(fn,netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx sysfileid(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft){ return sysfileid(fn,ft,netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx sysfileid(netrexx.lang.Rexx fn,netrexx.lang.Rexx ft,netrexx.lang.Rexx fp){netrexx.lang.Rexx file1;java.lang.String path;netrexx.lang.Rexx path1=null;netrexx.lang.Rexx file2=null; file1=fileid(fn,ft); if ((new java.io.File(netrexx.lang.Rexx.toString(file1))).exists()) return file1; if (fp.OpNotEq(null,$04)) { file1=fileid(fn,ft,fp); if ((new java.io.File(netrexx.lang.Rexx.toString(file1))).exists()) return file1; } path=$classpath; {for(;;){if(!netrexx.lang.Rexx.toRexx(path).OpNotEq(null,$04))break; {netrexx.lang.Rexx $15[]=new netrexx.lang.Rexx[3];$15[1]=netrexx.lang.Rexx.toRexx($ps);netrexx.lang.RexxParse.parse(netrexx.lang.Rexx.toRexx(path),$053,$15);path1=$15[0];path=netrexx.lang.Rexx.toString($15[2]);} file2=fileid(fn,ft,path1); if ((new java.io.File(netrexx.lang.Rexx.toString(file2))).exists()) return file2; }} path=$path; {for(;;){if(!netrexx.lang.Rexx.toRexx(path).OpNotEq(null,$04))break; {netrexx.lang.Rexx $16[]=new netrexx.lang.Rexx[3];$16[1]=netrexx.lang.Rexx.toRexx($ps);netrexx.lang.RexxParse.parse(netrexx.lang.Rexx.toRexx(path),$053,$16);path1=$16[0];path=netrexx.lang.Rexx.toString($16[2]);} file2=fileid(fn,ft,path1); if ((new java.io.File(netrexx.lang.Rexx.toString(file2))).exists()) return file2; }} Rey.RT.ReyMsg.warning((netrexx.lang.Rexx.toRexx("Required System File:").OpCcblank(null,file1)).OpCcblank(null,netrexx.lang.Rexx.toRexx("cannot be found!"))); return file1;} public netrexx.lang.Rexx query_exists(){ if ((!(this.exists()))) return netrexx.lang.Rexx.toRexx(""); return FileFullName;} public netrexx.lang.Rexx FileDateTime(){netrexx.lang.Rexx yyyy=null;netrexx.lang.Rexx mm=null;netrexx.lang.Rexx dd=null;netrexx.lang.Rexx hhxmmxss=null; if (this.FileDTS.OpEq(null,$04)) return netrexx.lang.Rexx.toRexx(""); {netrexx.lang.Rexx $17[]=new netrexx.lang.Rexx[5];netrexx.lang.RexxParse.parse(this.FileDTS,$054,$17);yyyy=$17[0];mm=$17[1];dd=$17[2];hhxmmxss=$17[3];} return ((((mm.OpCc(null,$055)).OpCc(null,dd)).OpCc(null,$055)).OpCc(null,yyyy)).OpCcblank(null,hhxmmxss);} public netrexx.lang.Rexx FileTimeStamp(){ if (this.FileDTS.OpEq(null,$04)) return netrexx.lang.Rexx.toRexx(""); return this.FileDTS;} public netrexx.lang.Rexx FileFormat(){ return netrexx.lang.Rexx.toRexx(java.lang.String.valueOf(FileRecType)+" "+FileRecLen);} public netrexx.lang.Rexx FileInfo(){ return ((FileFormat()).OpCcblank(null,new netrexx.lang.Rexx(FileNumberOfLines))).OpCcblank(null,FileDateTime());} private void load_lines(){int i_line;netrexx.lang.Rexx x=null; if (trace_io>0) Rey.RT.ReyMsg.info((netrexx.lang.Rexx.toRexx("Loading lines of File:").OpCcblank(null,FileName)).OpCcblank(null,$056)); i_line=0; FileLinesBuffered=false; FileLines=(netrexx.lang.Rexx)null; FileLines=netrexx.lang.Rexx.toRexx(""); i_line=0; {for(;;){if(!((this.lines())>0))break; x=this.linein(); i_line++; FileLines.getnode(new netrexx.lang.Rexx(i_line)).leaf=x; x=(netrexx.lang.Rexx)null; }} FileLinesBuffered=true; CurLineNo=0; CurLine=(netrexx.lang.Rexx)null; FileNumberOfLines=i_line; Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("after loading:").OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("number of lines is:"))).OpCcblank(null,new netrexx.lang.Rexx(FileNumberOfLines))); FileStatus=(byte)5; return;} private void save_lines(){int i_line=0; FileLinesBuffered=false; {int $18=FileNumberOfLines;i_line=1;i_line:for(;i_line<=$18;i_line++){ this.lineout(FileLines.getnode(new netrexx.lang.Rexx(i_line)).leaf); }}/*i_line*/ CurLineNo=0; CurLine=(netrexx.lang.Rexx)null; FileLinesBuffered=false; FileLines=(netrexx.lang.Rexx)null; return;} public long SeekTo(long start){long JavaPos=0;java.io.IOException e=null; {try{seeking_to_start:do{ if (start==0) return FileReadLocation; if (start==FileReadLocation) return FileReadLocation; if (FileOrganisation!=RANDOM) { Rey.RT.ReyMsg.error(($014.OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("not accessed in RANDOM mode"))); Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("please correct program!")); } JavaPos=start-1; AttachedRAF.seek(JavaPos); FileReadLocation=JavaPos+1; FileWriteLocation=FileReadLocation; return FileReadLocation;}while(false);} catch (java.io.IOException $19){e=$19; Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("IO Exception: "+e.toString()+" "+"encountered")); Rey.RT.ReyMsg.abort(((netrexx.lang.Rexx.toRexx("unable to position File:").OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("to location:"))).OpCcblank(null,new netrexx.lang.Rexx(start))); return (long)0; }}/*seeking_to_start*/} public static int copyfile(netrexx.lang.Rexx fin,netrexx.lang.Rexx fout){ return copyfile(fin,fout,false);}public static int copyfile(netrexx.lang.Rexx fin,netrexx.lang.Rexx fout,boolean inform){Rey.RT.ReyFile FD_fin;Rey.RT.ReyFile FD_fout;int buf_size;netrexx.lang.Rexx sbuf=null;netrexx.lang.Rexx sbuf_size=null;java.io.IOException e=null; if ((!(exists(fin)))) { Rey.RT.ReyMsg.error((((($02.OpCcblank(null,fin)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist -cannot copy:"))).OpCcblank(null,fin)).OpCcblank(null,$057)).OpCcblank(null,fout)); } FD_fin=Rey.RT.ReyFile.FD(fin).access(netrexx.lang.Rexx.toRexx("READ")); FD_fout=Rey.RT.ReyFile.FD(fout).access(netrexx.lang.Rexx.toRexx("REWRITE")); buf_size=1024*64; if (trace_io>3) { Rey.RT.ReyMsg.info((((netrexx.lang.Rexx.toRexx("COPYING File:").OpCcblank(null,FD_fin.FileName)).OpCcblank(null,$058)).OpCcblank(null,new netrexx.lang.Rexx(FD_fin.FileSize))).OpCcblank(null,$059)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(" to File:").OpCcblank(null,FD_fout.FileName)); } {try{$20:for(;;){if(!((FD_fin.chars())>0))break; sbuf=FD_fin.charin(buf_size); sbuf_size=sbuf.length(); if (sbuf_size.OpEq(null,$01)) break $20; FD_fout.charout(sbuf); }}catch (java.io.IOException $21){e=$21; Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("unexpected IO Exception: "+e.toString()+" "+"encountered")); Rey.RT.ReyMsg.info((((netrexx.lang.Rexx.toRexx("copying of File:").OpCcblank(null,FD_fin.FileName)).OpCcblank(null,$057)).OpCcblank(null,FD_fout.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("interrupted!"))); Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("incomplete output file, unable to continue.")); }} FD_fin.close(); FD_fout.close(); sbuf=(netrexx.lang.Rexx)null; if ((FD_fin.FileFile.length())!=(FD_fout.FileFile.length())) { Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("Fatal COPYFILE-error, output file truncated?")); } if (inform) Rey.RT.ReyMsg.info((($014.OpCcblank(null,fin)).OpCcblank(null,$060)).OpCcblank(null,fout)); return 0;} public static int movefile(netrexx.lang.Rexx fin,netrexx.lang.Rexx fout){ return movefile(fin,fout,false);}public static int movefile(netrexx.lang.Rexx fin,netrexx.lang.Rexx fout,boolean inform){ if ((!(exists(fin)))) { Rey.RT.ReyMsg.error((($014.OpCcblank(null,fin)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist, eannot move to:"))).OpCcblank(null,fout)); Rey.RT.ReyMsg.abort(); } copyfile(fin,fout,false); erase(fin); if (inform) Rey.RT.ReyMsg.info((($014.OpCcblank(null,fin)).OpCcblank(null,$061)).OpCcblank(null,fout)); return 0;} public static boolean isEmpty(netrexx.lang.Rexx fin){boolean iflag;Rey.RT.ReyFile temp_FD; iflag=false; if ((!(exists(fin)))) { Rey.RT.ReyMsg.error(($014.OpCcblank(null,fin)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does NOT exist, cannot test for EmptyNess"))); return true; } temp_FD=new Rey.RT.ReyFile(fin); if (temp_FD.FileSize>0) iflag=false; else iflag=true; temp_FD=(Rey.RT.ReyFile)null; return iflag;} private long max(long x,long y){ if (x>y) return x; else return y;} public static netrexx.lang.Rexx getDirectory(){ return netrexx.lang.Rexx.toRexx(Rey.RT.ReyFile.$directory);} public static netrexx.lang.Rexx getReyHome(){java.lang.String path;netrexx.lang.Rexx path1=null;java.lang.String ds2=null;netrexx.lang.Rexx disk2=null;netrexx.lang.Rexx path2=null;netrexx.lang.Rexx etc2=null; if (ReyHome!=null) { Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("using given environment variable ReyHome:"+" "+ReyHome)); return netrexx.lang.Rexx.toRexx(ReyHome); } path=$classpath; Rey.RT.ReyMsg.info2(netrexx.lang.Rexx.toRexx("searching for ReyHome:")); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("classpath is:"+" "+path)); {$25:for(;;){if(!netrexx.lang.Rexx.toRexx(path).OpNotEq(null,$04))break; {netrexx.lang.Rexx $22[]=new netrexx.lang.Rexx[3];$22[1]=netrexx.lang.Rexx.toRexx($ps);netrexx.lang.RexxParse.parse(netrexx.lang.Rexx.toRexx(path),$053,$22);path1=$22[0];path=netrexx.lang.Rexx.toString($22[2]);} ds2=$ds+$fs; if ((path1.pos(netrexx.lang.Rexx.toRexx(ds2))).OpGt(null,$01)) { {netrexx.lang.Rexx $23[]=new netrexx.lang.Rexx[5];$23[1]=netrexx.lang.Rexx.toRexx(ds2);$23[3]=netrexx.lang.Rexx.toRexx($fs);netrexx.lang.RexxParse.parse(path1,$062,$23);disk2=$23[0];path2=$23[2];etc2=$23[4];} } else { {netrexx.lang.Rexx $24[]=new netrexx.lang.Rexx[3];$24[0]=netrexx.lang.Rexx.toRexx($fs);netrexx.lang.RexxParse.parse(path1,$063,$24);path2=$24[1];etc2=$24[2];} disk2=netrexx.lang.Rexx.toRexx(""); } if (path2.OpEq(null,$064)&etc2.OpEq(null,$04)) { ReyHome=netrexx.lang.Rexx.toString(path1); break $25; } if (path2.OpEq(null,$064)&etc2.OpEq(null,$065)) { ReyHome=netrexx.lang.Rexx.toString(path2); if (disk2.OpNotEq(null,$04)) ReyHome=netrexx.lang.Rexx.toString((disk2.OpCc(null,netrexx.lang.Rexx.toRexx(ds2))).OpCc(null,path2)); break $25; } }} if (netrexx.lang.Rexx.toRexx(ReyHome).OpEq(null,$04)) { Rey.RT.ReyMsg.error(netrexx.lang.Rexx.toRexx("unable to determine Rey Home Directory")); Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("Please set Environment Variable ReyHome to proper directory")); } if (Rey.RT.ReyMsg.opt_verbose>2) Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("... using ReyHome:"+" "+ReyHome)); return netrexx.lang.Rexx.toRexx(ReyHome);} public static netrexx.lang.Rexx getReyRJar(){netrexx.lang.Rexx Jar; Jar=((getReyHome()).OpCc(null,netrexx.lang.Rexx.toRexx($fs))).OpCc(null,$065); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("... using Rey Run-Time Library:").OpCcblank(null,Jar)); return Jar;} public static netrexx.lang.Rexx getReyCJar(){netrexx.lang.Rexx Jar; Jar=((getReyHome()).OpCc(null,netrexx.lang.Rexx.toRexx($fs))).OpCc(null,$066); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("... using Rey Compiler Library:").OpCcblank(null,Jar)); return Jar;} public static netrexx.lang.Rexx getRexx2NrxJar(){ return getReyRJar();} public static netrexx.lang.Rexx query_exists(netrexx.lang.Rexx fname){netrexx.lang.Rexx ffull; if ((!((new java.io.File(netrexx.lang.Rexx.toString(fname))).exists()))) return netrexx.lang.Rexx.toRexx(""); ffull=Rey.RT.ReyFile.FD(fname).FileFullName; Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("in query_exists, fullname is:").OpCcblank(null,ffull)); return ffull;} public static netrexx.lang.Rexx FileList(){ return FileList(netrexx.lang.Rexx.toRexx(""),netrexx.lang.Rexx.toRexx("."),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx FileList(netrexx.lang.Rexx file_list){ return FileList(file_list,netrexx.lang.Rexx.toRexx("."),netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx FileList(netrexx.lang.Rexx file_list,netrexx.lang.Rexx dir_name){ return FileList(file_list,dir_name,netrexx.lang.Rexx.toRexx(""));}public static netrexx.lang.Rexx FileList(netrexx.lang.Rexx file_list,netrexx.lang.Rexx dir_name,netrexx.lang.Rexx extensions){java.io.File FileDir;java.lang.String name_list[];int n_names;netrexx.lang.Rexx result_Stem;int n_results;int i=0;java.lang.String file_name1=null;netrexx.lang.Rexx name1=null;netrexx.lang.Rexx type1=null;int ix=0;netrexx.lang.Rexx file_mask1=null;netrexx.lang.Rexx name_mask1=null;netrexx.lang.Rexx type_mask1=null; if (dir_name.OpEq(null,$06)|dir_name.OpEq(null,$04)) dir_name=netrexx.lang.Rexx.toRexx(Rey.RT.ReyFile.$directory); if (trace_io>0) { Rey.RT.ReyMsg.info2(netrexx.lang.Rexx.toRexx("Processing Directory/File:").OpCcblank(null,dir_name)); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("Given List:").OpCcblank(null,Rey.RT.ReyFunc.quoted(file_list))); Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("extensions wanted:").OpCcblank(null,Rey.RT.ReyFunc.quoted(extensions))); } FileDir=new java.io.File(netrexx.lang.Rexx.toString(dir_name)); if ((FileDir.isDirectory()?1:0)==0) { Rey.RT.ReyMsg.error(($014.OpCcblank(null,dir_name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("is NO directory"))); return netrexx.lang.Rexx.toRexx(""); } name_list=FileDir.list(); n_names=name_list.length; if (new netrexx.lang.Rexx(trace_io).toboolean()) Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(">> Directory contains:"+" "+n_names+" "+"entries")); result_Stem=netrexx.lang.Rexx.toRexx(""); n_results=0; {int $26=n_names;i=1;i:for(;i<=$26;i++){ file_name1=name_list[i-1]; if ((new java.io.File(file_name1)).isDirectory()) continue i; name1=filename(netrexx.lang.Rexx.toRexx(file_name1)); type1=filetype(netrexx.lang.Rexx.toRexx(file_name1)); if (extensions.OpNotEq(null,$04)&((!(Rey.RT.ReyFunc.is_member(type1,extensions))))) continue i; if (file_list.OpEq(null,$04)|file_list.OpEq(null,$067)) { n_results++; result_Stem.getnode(new netrexx.lang.Rexx(n_results)).leaf=netrexx.lang.Rexx.toRexx(file_name1); continue i; } file_list=file_list.changestr(new netrexx.lang.Rexx(','),new netrexx.lang.Rexx(' ')); {int $27=(file_list.words()).toint();ix=1;ix:for(;ix<=$27;ix++){ file_mask1=file_list.word(new netrexx.lang.Rexx(ix)).strip(); name_mask1=filename(file_mask1); type_mask1=filetype(file_mask1); if ((Rey.RT.ReyFunc.masked(name1,name_mask1))&(Rey.RT.ReyFunc.masked(type1,type_mask1))) { n_results++; result_Stem.getnode(new netrexx.lang.Rexx(n_results)).leaf=netrexx.lang.Rexx.toRexx(file_name1); continue i; } }}/*ix*/ }}/*i*/ result_Stem.getnode(new netrexx.lang.Rexx((byte)0)).leaf=new netrexx.lang.Rexx(n_results); return result_Stem;} public static void displayFileTable(){int ii=0;Rey.RT.ReyFile fx=null;netrexx.lang.Rexx fn=null; Rey.RT.ReyMsg.info2(netrexx.lang.Rexx.toRexx("FileTable of current program:")); {int $28=n_files;ii=1;ii:for(;ii<=$28;ii++){ fx=FileTable[ii]; if (fx==null) continue ii; fn=fx.FileFullName; Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("#"+ii+" "+":").OpCcblank(null,fn)); }}/*ii*/ return;} public void setFilter(int zone_from,int zone_to){ setFilter(zone_from,zone_to,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null);return;}public void setFilter(int zone_from,int zone_to,netrexx.lang.Rexx Locate_String){ setFilter(zone_from,zone_to,Locate_String,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null);return;}public void setFilter(int zone_from,int zone_to,netrexx.lang.Rexx Locate_String,netrexx.lang.Rexx Find_String){ setFilter(zone_from,zone_to,Locate_String,Find_String,(netrexx.lang.Rexx)null);return;}public void setFilter(int zone_from,int zone_to,netrexx.lang.Rexx Locate_String,netrexx.lang.Rexx Find_String,netrexx.lang.Rexx Avoid_String){ FileFilter=true; FileZoneFrom=zone_from; FileZoneTo=zone_to; FileLocateString=Locate_String; FileFindString=Find_String; FileAvoidString=Avoid_String; if (FileLocateString.OpEq(null,$04)) FileLocateString=(netrexx.lang.Rexx)null; if (FileFindString.OpEq(null,$04)) FileFindString=(netrexx.lang.Rexx)null; if (FileAvoidString.OpEq(null,$04)) FileAvoidString=(netrexx.lang.Rexx)null; return;} public static void setFileFilter(netrexx.lang.Rexx this_FileName,int zone_from,int zone_to){ setFileFilter(this_FileName,zone_from,zone_to,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null);return;}public static void setFileFilter(netrexx.lang.Rexx this_FileName,int zone_from,int zone_to,netrexx.lang.Rexx Locate_String){ setFileFilter(this_FileName,zone_from,zone_to,Locate_String,(netrexx.lang.Rexx)null,(netrexx.lang.Rexx)null);return;}public static void setFileFilter(netrexx.lang.Rexx this_FileName,int zone_from,int zone_to,netrexx.lang.Rexx Locate_String,netrexx.lang.Rexx Find_String){ setFileFilter(this_FileName,zone_from,zone_to,Locate_String,Find_String,(netrexx.lang.Rexx)null);return;}public static void setFileFilter(netrexx.lang.Rexx this_FileName,int zone_from,int zone_to,netrexx.lang.Rexx Locate_String,netrexx.lang.Rexx Find_String,netrexx.lang.Rexx Avoid_String){Rey.RT.ReyFile this_FD; this_FD=FD(this_FileName); this_FD.setFilter(zone_from,zone_to,Locate_String,Find_String,Avoid_String); return;} private boolean FilterLine(netrexx.lang.Rexx xline){long len1=0;netrexx.lang.Rexx this_zone=null;netrexx.lang.Rexx len2=null;netrexx.lang.Rexx len3=null; if ((!this.FileFilter)) return false; if (FileLocateString!=null) { len1=length(FileLocateString); if ((xline.substr(new netrexx.lang.Rexx((byte)1),new netrexx.lang.Rexx(len1))).OpNotEq(null,FileLocateString)) return false; } {/*select*/ if (this.FileZoneFrom>0){ if (this.FileZoneTo>0) { this_zone=xline.substr(new netrexx.lang.Rexx(FileZoneFrom),new netrexx.lang.Rexx((FileZoneTo-FileZoneFrom)+1)); } else { this_zone=xline.substr(new netrexx.lang.Rexx(FileZoneFrom)); } } else{{ this_zone=xline; }} } if (FileFindString!=null) { len2=FileFindString.length(); if ((this_zone.substr(new netrexx.lang.Rexx((byte)1),len2)).OpNotEq(null,FileFindString)) return false; } if (FileAvoidString!=null) { len3=FileAvoidString.length(); if ((this_zone.substr(new netrexx.lang.Rexx((byte)1),len3)).OpEq(null,FileAvoidString)) return false; } return true;} public static netrexx.lang.Rexx get_directory(){ return netrexx.lang.Rexx.toRexx($directory);} public void finish(){ closeAllFiles(); return;} public static void type(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f);xf.type(); return;} public void type(){ type(24);return;}public void type(int plength){int n;netrexx.lang.Rexx xx=null;netrexx.lang.Rexx xop=null; this.open(); n=0; Rey.RT.ReyMsg.info2(((netrexx.lang.Rexx.toRexx("Display of File:").OpCcblank(null,this.FileName)).OpCcblank(null,Rey.RT.ReyTime.date(new netrexx.lang.Rexx('N')))).OpCcblank(null,Rey.RT.ReyTime.time(new netrexx.lang.Rexx('N')))); {$29:for(;;){if(!((this.lines())>0))break; xx=this.linein(); netrexx.lang.RexxIO.Say(xx); n++; if ((n%plength)==0) { xop=Rey.RT.ReyMsg.askfor(netrexx.lang.Rexx.toRexx(" Press any key to continue, enter STOP to Interrupt")); if (xop.OpEq(null,$068)) break $29; } }} this.close(); return;} public static void rename(netrexx.lang.Rexx f1,netrexx.lang.Rexx f2){ Rey.RT.SysCmd.exec($069.OpCc(null,f1),f2); return;} public static boolean EOF(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; xf=FD(f); if ((xf.lines())==0) return true; return false;} public boolean EOF(){ if ((this.lines())==0) return true; return false;}} C:\Rey\RT>rem ============================================================ NetRexx portable processor, version 2.05 Copyright (c) IBM Corporation, 2005. All rights reserved. Program ReyFile.nrx === class Rey.RT.ReyFile === method init function get_version constructor ReyFile(Rexx) function ReyFileNo(Rexx) function FD(Rexx) method access(Rexx) 441 +++ catch e1=FileNotFoundException +++ ^^ +++ Warning: Variable is set but not used method lineout(Rexx) method lineout(Rexx,int) function lineout(Rexx,Rexx) method charout(Rexx) method charout(Rexx,long) function charout(Rexx,Rexx) function charout(Rexx,Rexx,long) function traceio(int) method open(Rexx) 558 +++ xf=this.access(access_method) /* access returns file pointer, but */ +++ ^^ +++ Warning: Variable is set but not used function open(Rexx,Rexx) function read(Rexx) method exists overrides File.exists function exists(Rexx) method scratch function scratch(Rexx) function delete(Rexx) method extend function extend(Rexx) method close function close(Rexx) 680 +++ xf=FD_object.close() +++ ^^ +++ Warning: Variable is set but not used method flush signals IOException method finalize overrides Object.finalize function closeAllFiles 705 +++ name=CurFile.FileName +++ ^^^^ +++ Warning: Variable is set but not used method lineout method charout method linein 774 +++ CurLine=AttachedDIS.readLine() +++ ^^^^^^^^ +++ Warning: The method 'DataInputStream.readLine' has been deprecated method linein(int,int) function linein(Rexx) function linein(Rexx,int,int) method lines function lines(Rexx) function linesin(Rexx,Rexx) method linesin(int) function linesout(Rexx,Rexx) signals IOException method linesout(Rexx) function alloc(Rexx,Rexx,Rexx) function free(Rexx,Rexx) function fileid(Rexx,Rexx,Rexx,Rexx) function workfile(Rexx,Rexx,Rexx) function parsefid(Rexx) function filename(Rexx) function filetype(Rexx) function filepath(Rexx) function unpack(Rexx,Rexx) function fullname(Rexx) function ispacked(Rexx) function isopen(Rexx) function erase(Rexx) method erase function purge(Rexx) function stream(Rexx,Rexx,Rexx) function length(Rexx) function DTS function DTS(Rexx) method chars function chars(Rexx) method charin(int) signals IOException method charin(long,int) signals IOException function charin(Rexx,long,int) signals IOException function filespec(Rexx,Rexx) function nametype(Rexx) function filedrive(Rexx) function sysfileid(Rexx,Rexx,Rexx) method query_exists method FileDateTime method FileTimeStamp method FileFormat method FileInfo method load_lines method save_lines method SeekTo(long) function copyfile(Rexx,Rexx,boolean) function movefile(Rexx,Rexx,boolean) function isEmpty(Rexx) method max(long,long) function getDirectory function getReyHome function getReyRJar function getReyCJar function getRexx2NrxJar function query_exists(Rexx) function FileList(Rexx,Rexx,Rexx) function displayFileTable method setFilter(int,int,Rexx,Rexx,Rexx) function setFileFilter(Rexx,int,int,Rexx,Rexx,Rexx) method FilterLine(Rexx) function get_directory method finish function type(Rexx) method type(int) function rename(Rexx,Rexx) function EOF(Rexx) method EOF 184 +++ PriorFileNo = int 0 /* backwards link for multiple files with same name*/ +++ ^^^^^^^^^^^ +++ Warning: Private property is defined but not used 104 +++ System_name = 'Rey' +++ ^^^^^^^^^^^ +++ Warning: Private property is defined but not used 101 +++ SEQUENTIAL=byte 1 /* File Organisation mode 1; sequential (default)*/ +++ ^^^^^^^^^^ +++ Warning: Private property is defined but not used 200 +++ method init private +++ ^^^^ +++ Warning: Private method is defined but not used C:\Rey\RT\ReyFile.java:76: No variable RT defined in class Rey.RT.Rey. private static int debug=Rey.RT.Options.opt_debug; ^ C:\Rey\RT\ReyFile.java:93: Class Rey.RT.Rey. RT not found. private static Rey.RT.ReyFile FileTable[]=new Rey.RT.ReyFile[m_files+1]; ^ C:\Rey\RT\ReyFile.java:93: Incompatible type for new. Can't convert <error>[] to Rey.RT.Rey.RT.ReyFile[]. private static Rey.RT.ReyFile FileTable[]=new Rey.RT.ReyFile[m_files+1]; ^ C:\Rey\RT\ReyFile.java:93: Class Rey.RT.Rey. RT not found. private static Rey.RT.ReyFile FileTable[]=new Rey.RT.ReyFile[m_files+1]; ^ C:\Rey\RT\ReyFile.java:98: Class Rey.RT.Rey. RT not found. private static Rey.RT.ReyFile CurFile=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:98: Class Rey.RT.Rey. RT not found. private static Rey.RT.ReyFile CurFile=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:201: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("ReyHome is:"+" "+ReyHome)); ^ C:\Rey\RT\ReyFile.java:208: Class Rey.RT.Rey. RT not found. super(netrexx.lang.Rexx.toString(name));netrexx.lang.Rexx lower_name;netrexx.lang.Rexx old_file_no;Rey.RT.ReyFile old_FD=null;int file_no1=0; ^ C:\Rey\RT\ReyFile.java:213: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.warning((($02.OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("already attached to file-no:"))).OpCcblank(null,old_file_no)); ^ C:\Rey\RT\ReyFile.java:215: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(" Full name is:").OpCcblank(null,old_FD.FileFullName)); ^ C:\Rey\RT\ReyFile.java:216: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx(" please revise program!")); ^ C:\Rey\RT\ReyFile.java:230: No variable RT defined in class Rey.RT.Rey. if (file_no==0) Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("too many files open, max.="+m_files)); ^ C:\Rey\RT\ReyFile.java:234: Class Rey.RT.Rey. RT not found in =. FileTable[file_no]=this; ^ C:\Rey\RT\ReyFile.java:234: Incompatible type for =. Can't convert Rey.RT.ReyFile to Rey.RT.Rey.RT.ReyFile. FileTable[file_no]=this; ^ C:\Rey\RT\ReyFile.java:255: Class Rey.RT.Rey. RT not found in =. CurFile=this; ^ C:\Rey\RT\ReyFile.java:255: Incompatible type for =. Can't convert Rey.RT.ReyFile to Rey.RT.Rey.RT.ReyFile. CurFile=this; ^ C:\Rey\RT\ReyFile.java:259: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("TraceIO ReyFile: File:").OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("attached to file_no:"))).OpCcblank(null,new netrexx.lang.Rexx(file_no))); ^ C:\Rey\RT\ReyFile.java:265: Class Rey.RT.Rey. RT not found. public static Rey.RT.ReyFile FD(){ return FD(netrexx.lang.Rexx.toRexx(""));}public static Rey.RT.ReyFile FD(netrexx.lang.Rexx name){netrexx.lang.Rexx iparen;netrexx.lang.Rexx xname1=null;netrexx.lang.Rexx xname2=null;netrexx.lang.Rexx xname=null; ^ C:\Rey\RT\ReyFile.java:265: Class Rey.RT.Rey. RT not found. public static Rey.RT.ReyFile FD(){ return FD(netrexx.lang.Rexx.toRexx(""));}public static Rey.RT.ReyFile FD(netrexx.lang.Rexx name){netrexx.lang.Rexx iparen;netrexx.lang.Rexx xname1=null;netrexx.lang.Rexx xname2=null;netrexx.lang.Rexx xname=null; ^ C:\Rey\RT\ReyFile.java:278: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("MVS File-name:").OpCcblank(null,name)).OpCcblank(null,netrexx.lang.Rexx.toRexx("simulated by:"))).OpCcblank(null,xname)); ^ C:\Rey\RT\ReyFile.java:285: Class Rey.RT.Rey. RT not found in Rey.RT.Rey.RT.ReyFile FD(netrexx.lang.Rexx). if (name.OpEq(null,CurFile.FileName)) { ^ C:\Rey\RT\ReyFile.java:286: Class Rey.RT.Rey. RT not found in Rey.RT.Rey.RT.ReyFile FD(netrexx.lang.Rexx). file_no=CurFile.FileNo; ^ C:\Rey\RT\ReyFile.java:299: Class Rey.RT.Rey. RT not found. if (CurFile==null) CurFile=new Rey.RT.ReyFile(name); ^ C:\Rey\RT\ReyFile.java:302: Class Rey.RT.Rey. RT not found. CurFile=new Rey.RT.ReyFile(name); ^ C:\Rey\RT\ReyFile.java:303: Class Rey.RT.Rey. RT not found in Rey.RT.Rey.RT.ReyFile FD(netrexx.lang.Rexx). file_no=CurFile.FileNo; ^ C:\Rey\RT\ReyFile.java:310: Class Rey.RT.Rey. RT not found. public final Rey.RT.ReyFile access(netrexx.lang.Rexx access_method){java.io.File Fx;netrexx.lang.Rexx access_meth=null;netrexx.lang.Rexx access_options=null;java.lang.String RAFMode=null;boolean append_mode=false;java.io.FileNotFoundException e1=null;java.io.IOException e2=null; ^ C:\Rey\RT\ReyFile.java:329: No variable RT defined in class Rey.RT.Rey. if (trace_io!=0) Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("File No:"+" "+this.FileNo+" "+"Name:").OpCcblank(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("access method="))).OpCcblank(null,access_method)); ^ C:\Rey\RT\ReyFile.java:347: Class Rey.RT.Rey. RT not found in return. return this; ^ C:\Rey\RT\ReyFile.java:347: Incompatible type for return. Can't convert Rey.RT.ReyFile to Rey.RT.Rey.RT.ReyFile. return this; ^ C:\Rey\RT\ReyFile.java:364: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort((netrexx.lang.Rexx.toRexx("Input file: ").OpCc(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist!"))); ^ C:\Rey\RT\ReyFile.java:375: No variable RT defined in class Rey.RT.Rey. else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to read file:").OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:387: No variable RT defined in class Rey.RT.Rey. else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to REWRITE file:").OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:402: No variable RT defined in class Rey.RT.Rey. else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to WRITE/APPEND to file:").OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:417: No variable RT defined in class Rey.RT.Rey. else Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("unable to UPDATE file:").OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:421: Class Rey.RT.Rey. RT not found in return. return this; ^ C:\Rey\RT\ReyFile.java:421: Incompatible type for return. Can't convert Rey.RT.ReyFile to Rey.RT.Rey.RT.ReyFile. return this; ^ C:\Rey\RT\ReyFile.java:424: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort(((netrexx.lang.Rexx.toRexx("illegal access-method:").OpCcblank(null,access_method)).OpCcblank(null,netrexx.lang.Rexx.toRexx("specified for file:"))).OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:442: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort((($014.OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("does not exist, cannot:"))).OpCcblank(null,access_method));} ^ C:\Rey\RT\ReyFile.java:444: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort((((($015.OpCcblank(null,access_method)).OpCcblank(null,$014)).OpCcblank(null,FileName)).OpCcblank(null,$016)).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e2)))); ^ C:\Rey\RT\ReyFile.java:447: Class Rey.RT.Rey. RT not found in return. return this;} ^ C:\Rey\RT\ReyFile.java:447: Incompatible type for return. Can't convert Rey.RT.ReyFile to Rey.RT.Rey.RT.ReyFile. return this;} ^ C:\Rey\RT\ReyFile.java:458: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(oline); ^ C:\Rey\RT\ReyFile.java:468: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info((((($02.OpCcblank(null,this.FileName)).OpCcblank(null,$017)).OpCcblank(null,new netrexx.lang.Rexx(CurLineNo))).OpCc(null,$018)).OpCc(null,CurLine)); ^ C:\Rey\RT\ReyFile.java:489: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort(((((netrexx.lang.Rexx.toRexx("cannot write line:").OpCcblank(null,oline)).OpCcblank(null,$019)).OpCcblank(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("IO-Exception:"))).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); ^ C:\Rey\RT\ReyFile.java:505: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(oline); ^ C:\Rey\RT\ReyFile.java:508: Class Rey.RT.Rey. RT.ReyFile not found in int lineout(netrexx.lang.Rexx, netrexx.lang.Rexx). return FD(f).lineout(oline);} ^ C:\Rey\RT\ReyFile.java:513: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(text.OpCc(null,$020)); ^ C:\Rey\RT\ReyFile.java:520: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info((((($02.OpCcblank(null,this.FileName)).OpCcblank(null,$021)).OpCcblank(null,new netrexx.lang.Rexx(FileWriteLocation))).OpCcblank(null,$022)).OpCcblank(null,text)); ^ C:\Rey\RT\ReyFile.java:531: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(((netrexx.lang.Rexx.toRexx("unable to write:").OpCcblank(null,text)).OpCcblank(null,$019)).OpCcblank(null,FileName)); ^ C:\Rey\RT\ReyFile.java:532: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort(netrexx.lang.Rexx.toRexx("Fatal I/O Exception:"+" "+e.toString())); ^ C:\Rey\RT\ReyFile.java:544: Class Rey.RT.Rey. RT.ReyFile not found in int charout(netrexx.lang.Rexx, netrexx.lang.Rexx). return FD(f).charout(text);} ^ C:\Rey\RT\ReyFile.java:549: Class Rey.RT.Rey. RT.ReyFile not found in int charout(netrexx.lang.Rexx, netrexx.lang.Rexx, long). return FD(f).charout(text,start);} ^ C:\Rey\RT\ReyFile.java:557: Class Rey.RT.Rey. RT not found. public netrexx.lang.Rexx open(){ return open(netrexx.lang.Rexx.toRexx(""));}public netrexx.lang.Rexx open(netrexx.lang.Rexx access_method){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:561: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx open(netrexx.lang.Rexx f,netrexx.lang.Rexx access_method){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:565: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx read(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:578: No variable RT defined in class Rey.RT.Rey. if (trace_io!=0) Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("scratching file: ").OpCc(null,this.FileName)); ^ C:\Rey\RT\ReyFile.java:584: No variable RT defined in class Rey.RT.Rey. if (deleted&(trace_io!=0)) Rey.RT.ReyMsg.info(($014.OpCcblank(null,this.FileName)).OpCcblank(null,$023)); ^ C:\Rey\RT\ReyFile.java:585: No variable RT defined in class Rey.RT.Rey. if ((deleted?1:0)==0) Rey.RT.ReyMsg.info((netrexx.lang.Rexx.toRexx("*** unable to delete file: ").OpCc(null,this.FileName)).OpCcblank(null,$024)); ^ C:\Rey\RT\ReyFile.java:589: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx scratch(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:593: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx delete(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:602: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx extend(netrexx.lang.Rexx f){Rey.RT.ReyFile xf; ^ C:\Rey\RT\ReyFile.java:617: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.warning((($025.OpCc(null,this.FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("already closed, CLOSE"))).OpCcblank(null,$026)); ^ C:\Rey\RT\ReyFile.java:619: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(((($014.OpCcblank(null,this.FileName)).OpCcblank(null,$027)).OpCcblank(null,new netrexx.lang.Rexx(this.FileStatus))).OpCcblank(null,netrexx.lang.Rexx.toRexx("(-2 = already closed)"))); ^ C:\Rey\RT\ReyFile.java:648: No variable RT defined in class Rey.RT.Rey. if ((trace_io!=0)&!this.equals(Rey.RT.ReyMsg.FD_LogFile)) ^ C:\Rey\RT\ReyFile.java:649: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(($025.OpCcblank(null,FileName)).OpCcblank(null,$028));}while(false);} ^ C:\Rey\RT\ReyFile.java:651: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.warning(((netrexx.lang.Rexx.toRexx("unable to close file: ").OpCc(null,FileName)).OpCcblank(null,$029)).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); ^ C:\Rey\RT\ReyFile.java:652: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.info(netrexx.lang.Rexx.toRexx("processing continues ...")); ^ C:\Rey\RT\ReyFile.java:659: Class Rey.RT.Rey. RT not found. FileTable[file_no]=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:661: Class Rey.RT.Rey. RT not found. CurFile=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:673: Class Rey.RT.Rey. RT not found. public static netrexx.lang.Rexx close(netrexx.lang.Rexx f){Rey.RT.ReyFile FD_object;netrexx.lang.Rexx xf; ^ C:\Rey\RT\ReyFile.java:681: Class Rey.RT.Rey. RT not found. FD_object=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:705: Class Rey.RT.Rey. RT not found in void closeAllFiles(). name=CurFile.FileName; ^ C:\Rey\RT\ReyFile.java:706: No variable RT defined in class Rey.RT.Rey. if (CurFile.equals(Rey.RT.ReyMsg.FD_LogFile)) continue ii; ^ C:\Rey\RT\ReyFile.java:707: Class Rey.RT.Rey. RT not found in void closeAllFiles(). if ((CurFile.FileStatus!=0)&(CurFile.FileStatus!=(-2))) { ^ C:\Rey\RT\ReyFile.java:707: Class Rey.RT.Rey. RT not found in void closeAllFiles(). if ((CurFile.FileStatus!=0)&(CurFile.FileStatus!=(-2))) { ^ C:\Rey\RT\ReyFile.java:709: Class Rey.RT.Rey. RT.ReyFile not found in void closeAllFiles(). CurFile.close(); ^ C:\Rey\RT\ReyFile.java:711: Class Rey.RT.Rey. RT not found. FileTable[ii]=(Rey.RT.ReyFile)null; ^ C:\Rey\RT\ReyFile.java:715: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.closeLog(); ^ C:\Rey\RT\ReyFile.java:733: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.FD_infile=this.FD(); ^ C:\Rey\RT\ReyFile.java:734: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.infile=this.FileName; ^ C:\Rey\RT\ReyFile.java:735: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line=this.CurLine; ^ C:\Rey\RT\ReyFile.java:736: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); ^ C:\Rey\RT\ReyFile.java:736: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); ^ C:\Rey\RT\ReyFile.java:737: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_no=this.CurLineNo; ^ C:\Rey\RT\ReyFile.java:748: No variable RT defined in class Rey.RT.Rey. CurLine=Rey.RT.ReyMsg.askfor(netrexx.lang.Rexx.toRexx("Cmd>")); ^ C:\Rey\RT\ReyFile.java:753: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line=(netrexx.lang.Rexx)null; ^ C:\Rey\RT\ReyFile.java:754: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_no=0; ^ C:\Rey\RT\ReyFile.java:762: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.warning(($025.OpCc(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("reading past EOF!"))); ^ C:\Rey\RT\ReyFile.java:777: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.abort((((($025.OpCc(null,FileName)).OpCcblank(null,netrexx.lang.Rexx.toRexx("can not read line:"))).OpCcblank(null,new netrexx.lang.Rexx(CurLineNo))).OpCcblank(null,netrexx.lang.Rexx.toRexx("IOException:"))).OpCcblank(null,new netrexx.lang.Rexx(java.lang.String.valueOf(e)))); ^ C:\Rey\RT\ReyFile.java:792: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line=(netrexx.lang.Rexx)null; ^ C:\Rey\RT\ReyFile.java:793: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_no=0; ^ C:\Rey\RT\ReyFile.java:794: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_len=0; ^ C:\Rey\RT\ReyFile.java:797: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.FD_infile=CurFile; ^ C:\Rey\RT\ReyFile.java:798: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.infile=this.FileName; ^ C:\Rey\RT\ReyFile.java:799: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line=this.CurLine; ^ C:\Rey\RT\ReyFile.java:800: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); ^ C:\Rey\RT\ReyFile.java:800: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_len=(Rey.RT.ReyMsg.line.length()).toint(); ^ C:\Rey\RT\ReyFile.java:801: No variable RT defined in class Rey.RT.Rey. Rey.RT.ReyMsg.line_no=this.CurLineNo; ^ C:\Rey\RT\ReyFile.java:813: No variable RT defined in class Rey.RT.Rey. if (new netrexx.lang.Rexx(debug).toboolean()) Rey.RT.ReyMsg.debug(netrexx.lang.Rexx.toRexx(java.lang.String.valueOf(CurLineNo)+" "+": -EOF-")); ^ Too many errors. (The limit on reported errors is 100.) 203 errors Compilation of 'ReyFile.nrx' failed [javac failed, 9 warnings] _______________________________________________ Ibm-netrexx mailing list [hidden email]
Tom. (ths@db-123.com)
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Thomas Schneider schrieb am 17.02.2010 17:26: > Hi there at IBM NetRexx Group. > > Glad that I'm back on this community. > > Now, *I* do have problems to compile some quite ancient NetRexx Programs. > Hi Thomas, after unpacking the files and trying to compile: 69 +++ import Rey.RT. +++ ^^^ +++ Warning: No classes found for import from package 'Rey.RT.' Unnecessary import, you don't need to import your own package. 71 +++ class ReyFile extends File uses ReyMsg, ReyFunc, ReySymb +++ ^^^^^^ +++ Error: The class 'ReyMsg' cannot be found ReyMsg, ReyFunc, ReySymb needed. - -- Patric -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: GnuPT 2.5.2 iEYEARECAAYFAkt/ym0ACgkQfGgGu8y7ypCo4wCcDjS9GtuBMhfHsGOftVtA4cH2 QhQAoPgNZw//BaQro5tP1LfohAjqpk0w =CE3f -----END PGP SIGNATURE----- _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Thomas.Schneider.Wien
Tom,
in the classpath you have ReyC.jar - so you are looking for the Rey.RT package in this jar. This will find the previous version of all classes in the package Rey.RT in this jar (and I assume your build process makes a new jar when it it finished. You need to make sure that it can find the current versions of the classes. With this in mind, take the ReyC.jar off the classpath, and see to it that this classpath contains the directory on your filesystem that contains the root of the package hierarchy. This will enable the java compiler to find the fresh versions of your classes (important when you have dependencies) and will make it unnecessary to make a jar every time you compile. best regards, René Jansen. CLASSPATH=c:\Rey\ReyC.jar;c:\NetRexx\lib\NetRexxC.jar;c:\Programme\Java\jre6\bin;c:\Programme\Java\jdk1.6.0_10\lib\tools.jar On 17 feb 2010, at 17:26, Thomas Schneider wrote: > I cannot compile my own NetRexx programs anymore. > > I am attaching: > > my classpath in classpath.txt > my path in path.txt > > the sourcefile in Question in ReyFile.nrx > ... and the problem in question ReyFile.problems > > Obvioulsy, for some yet unknown reason, the 'prefix' of the classes in the > generated code is now DOUBLED (I think). > > Moreover, when I take the ReyFile.java.keep file, rename it to ReyFile.java, > and try to compile it, I get oher errors, saying I cannot compiles Classes > when annotation is not enabled. > > As I have the same problem with (all?) other classes as well (the *.nrx > of most of them *not been modified* for just a while ..), doese anyone > of you know what might be the *reason* ?? > Funny! _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Free forum by Nabble | Edit this page |