Add missing brackets.
[capital-apms-progress.git] / process / daily.p
blobdf8307e123b5121830645cda7ec59e95f67541a4
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF VAR log-depth AS INT NO-UNDO INITIAL 10.
8 DEF VAR host-name AS CHAR NO-UNDO.
9 DEF VAR physical-name AS CHAR NO-UNDO.
10 DEF VAR logical-name AS CHAR NO-UNDO.
11 DEF VAR service-name AS CHAR NO-UNDO.
13 /* _UIB-CODE-BLOCK-END */
14 &ANALYZE-RESUME
17 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
19 /* ******************** Preprocessor Definitions ******************** */
21 &Scoped-define PROCEDURE-TYPE Procedure
25 /* _UIB-PREPROCESSOR-BLOCK-END */
26 &ANALYZE-RESUME
30 /* *********************** Procedure Settings ************************ */
32 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
33 /* Settings for THIS-PROCEDURE
34 Type: Procedure
35 Allow:
36 Frames: 0
37 Add Fields to: Neither
38 Other Settings: CODE-ONLY COMPILE
40 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
42 /* ************************* Create Window ************************** */
44 &ANALYZE-SUSPEND _CREATE-WINDOW
45 /* DESIGN Window definition (used by the UIB)
46 CREATE WINDOW Procedure ASSIGN
47 HEIGHT = .43
48 WIDTH = 38.14.
50 &ANALYZE-RESUME
55 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
58 /* *************************** Main Block *************************** */
60 OUTPUT TO daily.log APPEND.
61 RUN log( 0, "Daily run starting" ).
62 RUN decode-parameters.
66 RUN log( 0, "Daily run complete" ).
67 PUT UNFORMATTED "-------------------------------------------------------------" SKIP.
69 OUTPUT CLOSE.
71 /* _UIB-CODE-BLOCK-END */
72 &ANALYZE-RESUME
75 /* ********************** Internal Procedures *********************** */
77 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE decode-parameters Procedure
78 PROCEDURE decode-parameters :
79 /*------------------------------------------------------------------------------
80 Purpose: Decode parameters supplied with -param "<params>"
81 ------------------------------------------------------------------------------*/
82 DEF VAR i AS INT NO-UNDO.
83 DEF VAR fval AS CHAR NO-UNDO.
84 DEF VAR param-name AS CHAR NO-UNDO.
85 DEF VAR param-value AS CHAR NO-UNDO.
87 DO i = 1 TO NUM-ENTRIES( SESSION:PARAMETER ):
88 fval = ENTRY( i, SESSION:PARAMETER ).
89 param-name = TRIM( ENTRY( 1, fval, "=")).
90 param-value = TRIM( ENTRY( 2, fval, "=")).
91 CASE param-name:
92 WHEN "log-depth" THEN log-depth = INTEGER(param-value).
93 WHEN "host" THEN host-name = param-value.
94 WHEN "logical" THEN logical-name = param-value.
95 WHEN "physical" THEN physical-name = param-value.
96 WHEN "service" THEN service-name = param-value.
97 OTHERWISE
98 RUN log( 0, "Unknown parameter: " + param-name).
99 END.
100 RUN log( 25, "param-name = >>" + param-name + "<<").
101 RUN log( 25, "param-value = >>" + param-value + "<<").
102 END.
104 RUN log( 15, "log-depth = " + STRING( log-depth ) ).
105 RUN log( 15, "host = " + host-name).
106 RUN log( 15, "physical = " + physical-name).
107 RUN log( 15, "logical = " + logical-name).
108 RUN log( 15, "service = " + service-name).
110 END PROCEDURE.
112 /* _UIB-CODE-BLOCK-END */
113 &ANALYZE-RESUME
116 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE log Procedure
117 PROCEDURE log :
118 /*------------------------------------------------------------------------------
119 Purpose: write output formatted as a log entry
120 ------------------------------------------------------------------------------*/
121 DEF INPUT PARAMETER depth AS INT NO-UNDO.
122 DEF INPUT PARAMETER entry-text AS CHAR NO-UNDO.
124 IF depth > log-depth THEN RETURN.
125 PUT UNFORMATTED STRING( YEAR(TODAY), "9999") + "-" + STRING( MONTH(TODAY), "99") + "-" + STRING( DAY(TODAY), "99")
126 + " " + STRING( TIME, "HH:MM:SS")
127 + " " + STRING( depth, ">>9")
128 + " " + entry-text
129 SKIP.
130 END PROCEDURE.
132 /* _UIB-CODE-BLOCK-END */
133 &ANALYZE-RESUME