Debian Codegraph @

packages/seacas/applications/blot/opnlog.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 SUBROUTINE OPNLOG (LOGU)
9 C=======================================================================
10
11 C --*** OPNLOG *** (BLOT) Open log file and write header
12 C -- Written by Amy Gilkey - revised 01/11/88
13 C --
14 C --OPNLOG opens the log file and writes the command line as the header
15 C --for the log file.
16 C --
17 C --Parameters:
18 C -- NLOG - IN/OUT - the log file number; returned <= if log file
19 C -- cannot be opened
20 C --
21 C --Common Variables:
22 C -- Uses NDB of /DBASE/
23 C -- Uses QAINFO of /PROGQA/
24
25 include 'params.blk'
26 include 'progqa.blk'
27 include 'dbase.blk'
28 include 'dbname.blk'
29
30 CHARACTER*2048 INLINE, FILNAM, ERRMSG
31 CHARACTER*256 STR
32 LOGICAL ISON
33
34 NLOG = LOGU
35 filnam = basenam(:lenstr(basenam)) // '.blot.log'
36
37 open (unit=nlog, file=filnam(:lenstr(filnam)), form='formatted',
38 * status='unknown', iostat=ierr)
39 IF (IERR .NE. 0) THEN
40 ERRMSG = 'Log file "'//FILNAM(:LENSTR(FILNAM))//
41 * '" could not be opened.'
42 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
43 GOTO 100
44 END IF
45
46 INLINE = '$$$ ' // QAINFO(1)
47 L = LENSTR (INLINE) + 1
48
49 IF (L .LT. LEN (INLINE)) INLINE(L+1:) = DBNAME
50 L = LENSTR (INLINE) + 1
51
52 CALL GRGPARD ('DEVICE', 1, ISON, STR)
53 IF (ISON) THEN
54 IF (L .LT. LEN (INLINE)) INLINE(L+1:) = STR
55 ELSE
56 IF (L .LT. LEN (INLINE)) INLINE(L+1:) = '""'
57 END IF
58 L = LENSTR (INLINE) + 1
59
60 CALL GRGPARD ('DEVICE', 2, ISON, STR)
61 IF (ISON) THEN
62 IF (L .LT. LEN (INLINE)) INLINE(L+1:) = STR
63 ELSE
64 IF (L .LT. LEN (INLINE)) INLINE(L+1:) = '""'
65 END IF
66 L = LENSTR (INLINE) + 1
67
68 WRITE (NLOG, '(A)', IOSTAT=IERR) INLINE(:L-1)
69 if (ierr .ne. 0) then
70 CALL PRTERR ('WARNING', 'Log file cannot be written')
71 NLOG = -1
72 GOTO 100
73 end if
74 100 CONTINUE
75 LOGU = NLOG
76 RETURN
77 END