1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11
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
*/
17 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
19 /* ******************** Preprocessor Definitions
******************** */
21 &Scoped-define PROCEDURE-TYPE Procedure
25 /* _UIB-PREPROCESSOR-BLOCK-END
*/
30 /* *********************** Procedure Settings
************************ */
32 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
33 /* Settings for
THIS-PROCEDURE
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
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.
71 /* _UIB-CODE-BLOCK-END
*/
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
, "=")).
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.
98 RUN log
( 0, "Unknown parameter: " + param-name
).
100 RUN log
( 25, "param-name = >>" + param-name
+ "<<").
101 RUN log
( 25, "param-value = >>" + param-value
+ "<<").
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
).
112 /* _UIB-CODE-BLOCK-END
*/
116 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE log Procedure
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")
132 /* _UIB-CODE-BLOCK-END
*/