John Forkosh Associates ®
D C L   U t i l i t i e s
Copyright © 1986-2001, John Forkosh Associates, Inc.
All rights reserved.

Click for:   homepage,   resume



DDDDDDDD     CCCCCCC  LLLLL      UUUU  UUUU TTTTTTTTTT   IIIIII   LLLLL        SSSSSSS 
DDDDDDDDD   CCCCCCCCC LLLLL      UUUU  UUUU TTTTTTTTTT   IIIIII   LLLLL       SSSSSSSSS
 DD     DD CC      CC  LL         UU    UU  TT  TT  TT     II      LL        SS        
 DD     DD CC          LL         UU    UU      TT         II      LL         SSSSSSS  
 DD     DD CC          LL         UU    UU      TT         II      LL          SSSSSSS 
 DD     DD CC      CC  LL     LL  UU    UU      TT         II      LL     LL         SS
DDDDDDDDD   CCCCCCCCC LLLLLLLLLL   UUUUUU      TTTT      IIIIII   LLLLLLLLLL SSSSSSSSS 
DDDDDDDD     CCCCCCC  LLLLLLLLLL    UUUU       TTTT      IIIIII   LLLLLLLLLL  SSSSSSS  

  1: $ goto start_of_job             ! skip header stub
  2: $!*****************************************************************************
  3: $!*
  4: $!* Copyright (c) 1989-1997, John Forkosh Associates.  All rights reserved.
  5: $!* ---------------------------------------------------------------------------
  6: $!*
  7: $!* Procedure:  apply.com  command {file_spec,@toc_file}
  8: $!*
  9: $!* Notes:
 10: $!*
 11: $!* ---------------------------------------------------------------------------
 12: $!* Revision History:
 13: $!* 01/13/98 J.Forkosh          Installation at CMB.
 14: $!*
 15: $!*****************************************************************************
 16: $ start_of_job:
 17: $ command = P1
 18: $ file_spec = P2
 19: $ toc_file = ""
 20: $ if toc_file .nes. "" then open/read input 'toc_file'
 21: $ say := write sys$output
 22: $ nfiles = 0
 23: $ nerrs = 0
 24: $ next_file:
 25: $       if toc_file .nes. "" then -
 26:                 read/end=end_of_files/err=end_of_files input file_spec
 27: $       if file_spec .eqs. "" then goto end_of_files
 28: $       fspec = f$search("''file_spec'")
 29: $       if fspec .nes. "" then goto apply_file
 30: $     not_found:
 31: $       if toc_file .eqs. "" then goto end_of_files
 32: $       say "File ''fspec' not found"
 33: $       nerrs = nerrs+1
 34: $       goto next_file
 35: $     apply_file:
 36: $       'command' 'fspec'
 37: $       nfiles = nfiles+1
 38: $       goto next_file
 39: $ end_of_files:
 40: $ say "#Files processed=",nfiles," #Not Found=",nerrs
 41: $ say "Have a nice day."
 42: $ if toc_file .nes. "" then close input
 43: $ exit
 44: 
 45: 
 46: $ goto start_of_job             ! skip header stub
 47: $!*****************************************************************************
 48: $!*
 49: $!* Copyright (c) 1989-1997, John Forkosh Associates.  All rights reserved.
 50: $!* ---------------------------------------------------------------------------
 51: $!*
 52: $!* Procedure:  differ.com  source_path  target_dir
 53: $!*
 54: $!* Purpose:    Runs diff/par against all files specified by source_path
 55: $!*             (one-by-one) against files of the same name in target_dir.
 56: $!*
 57: $!* Parameters: source_path     p1 = filespec (usually with some wildcard)
 58: $!*                             specifying files to be diffed.
 59: $!*             target_dir      p2 = directory against which source_path
 60: $!*                             files should be diffed.
 61: $!*
 62: $!* Notes:
 63: $!*
 64: $!* ---------------------------------------------------------------------------
 65: $!* Revision History:
 66: $!* 10/10/89 J.Forkosh          Installation at CMB.
 67: $!* 08/22/97 J.Forkosh          Unlimited usage license granted to BT.
 68: $!*
 69: $!*****************************************************************************
 70: $ start_of_job:
 71: $ source_path = P1
 72: $ target_dir = P2
 73: $ say := write sys$output
 74: $ nfiles = 0
 75: $ reset:
 76: $ on warning then goto reset
 77: $ on error then goto reset
 78: $ on severe_error then goto reset
 79: $ if nfiles .gt. 0 then say "Error diffing ",target_file," with ",target_dir
 80: $ next_file:
 81: $       fspec = f$search("''source_path'",1)
 82: $       if fspec .eqs. "" then goto end_of_files
 83: $       fdir = f$element(0,"]",fspec) + "]"
 84: $       fname = f$element(0,".",f$element(1,"]",fspec))
 85: $       fext  = f$element(0,";",f$element(1,".",f$element(1,"]",fspec)))
 86: $       if fext.eqs."OBJ" .or. fext.eqs."EXE" then goto next_file
 87: $       target_file = "''fname'.''fext'"
 88: $       nfiles = nfiles + 1
 89: $       say "----------------------------------------------------------"
 90: $       say nfiles,": diff ",target_file," ",target_dir
 91: $       fspec = f$search("''target_dir'''target_file'",2)
 92: $       if fspec .nes. "" then diff/par 'target_file' 'target_dir'
 93: $       if fspec .eqs. "" then say "Not found in ",target_dir
 94: $ goto next_file
 95: $ end_of_files:
 96: $ say "----------------------------------------------------------"
 97: $ say nfiles," files diffed."
 98: $ exit
 99: 
100: 
101: $ goto start_of_job             ! skip header stub
102: $!*****************************************************************************
103: $!*
104: $!* Copyright (c) 1989-1997, John Forkosh Associates.  All rights reserved.
105: $!* ---------------------------------------------------------------------------
106: $!*
107: $!* Procedure:  fcopy.com  source_path toc_file
108: $!*
109: $!* Notes:
110: $!*
111: $!* ---------------------------------------------------------------------------
112: $!* Revision History:
113: $!* 12/15/99 J.Forkosh          Installation at CMB.
114: $!*
115: $!*****************************************************************************
116: $ start_of_job:
117: $ source_path = P1
118: $ toc_file = P2
119: $ if toc_file .eqs. "" then exit
120: $ open/read input 'toc_file'
121: $ say := write sys$output
122: $ nfiles = 0
123: $ nerrs = 0
124: $ next_file:
125: $       read/end=end_of_files/err=end_of_files input fname
126: $       if fname .eqs. "" then goto end_of_files
127: $       fspec = "''source_path'''fname'"
128: $       if f$search("''fspec'") .nes. "" then goto copy_file
129: $     not_found:
130: $       say "File ''fspec' not found"
131: $       nerrs = nerrs+1
132: $       goto next_file
133: $     copy_file:
134: $       copy/nolog/read/write 'fspec' *
135: $       nfiles = nfiles+1
136: $       goto next_file
137: $ end_of_files:
138: $ say "#Files Copied=",nfiles," #Not Found=",nerrs
139: $ say "Have a nice day."
140: $ close input
141: $ exit
142: 
143: 
144: $ goto start_of_job             ! skip header stub
145: $!*****************************************************************************
146: $!*
147: $!* Copyright (c) 1989-1997, John Forkosh Associates.  All rights reserved.
148: $!* ---------------------------------------------------------------------------
149: $!*
150: $!* Procedure:  fsize.com  [filename]
151: $!*
152: $!* Purpose:    Displays sizes/total of all files whose names appear in
153: $!*             filename (which may have been previously created by
154: $!*             maketoc.com)
155: $!*
156: $!* Parameters: filename        p1 = filename containing names of files
157: $!*                             whose sizes are to be displayed/totalled.
158: $!*
159: $!* Notes:
160: $!*
161: $!* ---------------------------------------------------------------------------
162: $!* Revision History:
163: $!* 07/14/89 J.Forkosh          Installation at CMB.
164: $!* 08/22/97 J.Forkosh          Unlimited usage license granted to BT.
165: $!*
166: $!*****************************************************************************
167: $ start_of_job:
168: $ source_path = P1
169: $ if source_path .eqs. "" then exit
170: $ open/read input 'source_path'
171: $ say := write sys$output
172: $ nfiles = 0
173: $ totsize = 0
174: $ next_file:
175: $       read/end=end_of_files/err=end_of_files input fspec
176: $       if fspec .eqs. "" then goto end_of_files
177: $       nfiles = nfiles+1
178: $       fsize = f$file_attributes(fspec,"EOF")
179: $       fkbytes = (fsize+1)/2
180: $       totsize = totsize + fsize
181: $       say nfiles,")",fspec,": ",fkbytes,"K, ",fsize,"Blocks, Total:",totsize
182: $ goto next_file
183: $ end_of_files:
184: $ say "Total Size: ",(totsize+1)/2,"K, ",totsize,"Blocks"
185: $ say "Have a nice day."
186: $ close input
187: $ exit
188: 
189: 
190: $ goto start_of_job             ! skip header stub
191: $!*****************************************************************************
192: $!*
193: $!* Copyright (c) 1989, John Forkosh Associates.  All rights reserved.
194: $!* ---------------------------------------------------------------------------
195: $!*
196: $!* Procedure:  journal.com  [comment]  [filename]
197: $!*
198: $!* Purpose:    Writes (appends) comment to journal file, along with timestamp,
199: $!*             user, etc.
200: $!*
201: $!* Parameters: comment         p1 = comment to be placed in journal
202: $!*                             file (defaults to the word "Login").
203: $!*             filename        p2 = filename (full path) of journal file,
204: $!*                             to which comment is written (defaults
205: $!*                             to sys$login:login.txt).
206: $!*
207: $!* Notes:
208: $!*
209: $!* ---------------------------------------------------------------------------
210: $!* Revision History:
211: $!* 04/13/89 J.Forkosh          Installation at CMB.
212: $!* 08/22/97 J.Forkosh          Unlimited usage license granted to BT.
213: $!*
214: $!*****************************************************************************
215: $ start_of_job:
216: $ comment = p1
217: $ joufile = p2
218: $ if comment.eqs."" then comment = "Login"
219: $ if joufile.eqs."" then joufile = "sys$login:login.txt"
220: $ joupath = f$search("''joufile'")
221: $ sayjou := "write jouptr"
222: $ devnam = f$getdvi("sys$command","fulldevnam")
223: $ procnam = f$process()
224: $ uic = f$user()
225: $ time= f$extract(0,2,f$time())+f$extract(3,3,f$time())+f$extract(9,8,f$time())
226: $ if joupath.eqs."" then open/write jouptr 'joufile'
227: $ if joupath.nes."" then open/append jouptr 'joufile'
228: $ sayjou "''time' ''procnam'''uic'> ''comment'"
229: $ close jouptr
230: $ exit
231: $! ----------------------- END-OF-FILE JOURNAL.COM ----------------------------
232: 
233: 
234: $ goto start_of_job             ! skip header stub
235: $!*****************************************************************************
236: $!*
237: $!* Copyright (c) 1989, John Forkosh Associates.  All rights reserved.
238: $!* ---------------------------------------------------------------------------
239: $!*
240: $!* Procedure:  maketoc.com  [filename]
241: $!*
242: $!* Purpose:    Writes list of (source) files in present working/default
243: $!*             directory to filename.
244: $!*
245: $!* Parameters: filename        p1 = filename to write toc to (default is
246: $!*                             maketoc.txt).
247: $!*
248: $!* Notes:
249: $!*
250: $!* ---------------------------------------------------------------------------
251: $!* Revision History:
252: $!* 02/12/89 J.Forkosh          Installation at CMB.
253: $!* 08/22/97 J.Forkosh          Unlimited usage license granted to BT.
254: $!*
255: $!*****************************************************************************
256: $ start_of_job:
257: $ say := write sys$output
258: $ source_path = "*.*;0"
259: $ tocfile = p1
260: $ if tocfile.eqs."" then tocfile = "MAKETOC.TXT"
261: $ open/write toc 'tocfile'
262: $ nfiles = 0
263: $ next_file:
264: $       fspec = f$search("''source_path'")
265: $       if fspec .eqs. "" then goto end_of_files
266: $       fdir = f$element(0,"]",fspec) + "]"
267: $       fname = f$element(0,".",f$element(1,"]",fspec))
268: $       fext  = f$element(0,";",f$element(1,".",f$element(1,"]",fspec)))
269: $       if fext.eqs."OBJ" .or. fext.eqs."EXE" then goto next_file
270: $       if fext.eqs."LIS" .or. fext.eqs."MAP" then goto next_file
271: $       target_file = "''fname'.''fext'"
272: $       nfiles = nfiles + 1
273: $       write/err=end_of_files toc "''target_file'"
274: $ goto next_file
275: $ end_of_files:
276: $ say nfiles," files."
277: $ close toc
278: $ exit
279: 
280: 
281: $ goto start_of_job             ! skip header stub
282: $!*****************************************************************************
283: $!*
284: $!* Copyright (c) 1989, John Forkosh Associates.  All rights reserved.
285: $!* ---------------------------------------------------------------------------
286: $!*
287: $!* Procedure:  tree.com  [path]
288: $!*
289: $!* Purpose:    Displays directory tree from present default/working directory,
290: $!*             or from optional path.
291: $!*
292: $!* Parameters: path            p1 = path from which tree should be displayed
293: $!*                             (p1.eqs."" for present default directory)
294: $!*
295: $!* Notes:
296: $!*
297: $!* ---------------------------------------------------------------------------
298: $!* Revision History:
299: $!* 08/14/89 J.Forkosh          Installation at CMB.
300: $!* 08/22/97 J.Forkosh          Unlimited usage license granted to BT.
301: $!*
302: $!*****************************************************************************
303: $ start_of_job:
304: $ level = 0
305: $ ndirs = 0
306: $ path0 = "["+P1
307: $ if path0.eqs."[" then path0 = f$element(0,"]",f$directory())
308: $ write sys$output "From ''path0']..."
309: $ next_dir:
310: $       dpath = path'level'
311: $       dspec = f$search("''dpath']*.dir",level)
312: $       if dspec .eqs. "" then goto end_of_level
313: $       level = level + 1
314: $       ndirs = ndirs + 1
315: $       dpath = f$element(1,":",f$element(0,"]",dspec))
316: $       dname = f$element(0,".",f$element(1,"]",dspec))
317: $       if dname.eqs."000000" then goto end_of_level
318: $       path'level' = "''dpath'.''dname'"
319: $       prefix = f$extract(0,level+1,":                                       ")
320: $       write sys$output level,prefix,dname
321: $       goto next_dir
322: $ end_of_level:
323: $       level = level - 1
324: $       if level.ge.0 then goto next_dir
325: $ write sys$output ndirs," directories."
326: $ exit
327: 
328: 
329: $ goto start_of_job             ! skip header stub
330: $!*****************************************************************************
331: $!*
332: $!* Copyright (c) 1989, John Forkosh Associates.  All rights reserved.
333: $!* ---------------------------------------------------------------------------
334: $!*
335: $!* Procedure:  uncat.com  catfile  [getfile]
336: $!*
337: $!* Purpose:    "Untars" a file containing multiple files embedded within it,
338: $!*             in the form
339: $!*                     /*OPEN=file1.ext*/
340: $!*                     line 1 of file1.ext
341: $!*                     line 2 of file1.ext
342: $!*                     etc
343: $!*                     /*CLOSE=file1.ext*/
344: $!*                     /*OPEN=file2.ext*/
345: $!*                     line 1 of file2.ext
346: $!*                     line 2 of file2.ext
347: $!*                     etc
348: $!*                     /*CLOSE=file2.ext*/
349: $!*                     etc
350: $!*
351: $!* Parameters: catfile         p1 = ascii text file containing lines
352: $!*                             in the form shown above
353: $!*             [catfile]       p2 = optional filename to be extracted.
354: $!*                             If given, only that file is "untarred"
355: $!*                             from catfile; otherwise all files in
356: $!*                             catfile are untarred.
357: $!*
358: $!* Notes:
359: $!*
360: $!* ---------------------------------------------------------------------------
361: $!* Revision History:
362: $!* 08/12/89 J.Forkosh          Installation at CMB.
363: $!* 02/03/98 J.Forkosh          Limited usage license granted to BT.
364: $!*
365: $!*****************************************************************************
366: $ start_of_job:
367: $ goto startup
368: $ uncat_file:
369: $ read/end=eoj/err=eoj cat image
370: $ prefix = f$extract(0,cllen,image)
371: $ if f$locate(clstr,prefix).eq.0.and.f$length(prefix).gt.0 then goto next_file
372: $ write/err=eoj file image
373: $ goto uncat_file
374: $!=== done with current file
375: $ next_file:
376: $ close file
377: $!=== determine next file to uncat
378: $ find_opstr:
379: $ read/end=eoj/err=eoj cat image
380: $ prefix = f$extract(0,oplen,image)
381: $ if f$locate(opstr,prefix).ne.0.or.f$length(prefix).eq.0 then goto find_opstr
382: $ fname = f$extract(oplen,99,image)
383: $ fname = f$extract(0,f$locate(postfix,fname),fname)
384: $ if getfile.nes."".and.getfile.nes.fname then goto find_opstr
385: $ nfiles = nfiles + 1
386: $ say nfiles,": ",fname
387: $ open/write/err=eoj file 'fname'
388: $ goto uncat_file
389: $!=== initialization
390: $ startup:
391: $!--- parameters
392: $ catfile = P1
393: $ getfile = P2
394: $ opstr = "/*$OPEN="
395: $ clstr = "/*$CLOS="
396: $ oplen = f$length(opstr)
397: $ cllen = f$length(clstr)
398: $ postfix = "*/"
399: $!--- initialization
400: $ nfiles = 0
401: $ open/read/err=eoj cat 'catfile'
402: $ goto find_opstr
403: $!--- end-of-job
404: $ eoj:
405: $ close cat
406: $ exit
407: $!=========================== END-OF-FILE UNCAT.COM ===========================

Copyright © 1986-2001, John Forkosh Associates, Inc.   All rights reserved.
email: john@forkosh.com