automatic Html generation from Data Areas

Hi all!

Does anybody know if it’s possible to generate a HTML documentation based on a chosen Data Area.

For example: I want to describe an Interface with dozen of data fields. Would be kind if I could create a HTML document with basic information such as field-name, field-size … and so on.

tx a lot
Steve

Just use USR1057N to read a Natural Program/Data Area. And you could make a Program which does this for you.

Greetings
Sascha

Edit:
I would look if i post an Example here

Here is an small Example

L-ED-Z:


0010 DEFINE DATA LOCAL
0020  1 #ED-Z (A88)
0030 INIT<'**'>
0040  1 REDEFINE #ED-Z
0050  2 #ED-Z-STERNE (A2)
0060  2 #ED-Z-ART (A2)
0070  2 #ED-Z-REDEF (A1)
0080  2 #ED-Z-FILLER (A11)
0090  2 #ED-Z-FORMAT (A1)
0100  2 #ED-Z-LAENGE (A4)
0110  2 #ED-Z-MK-KOMMENTAR (A1)
0120  2 #ED-Z-STUFE (A1)
0130  2 #ED-Z-BEZEICHNER (A32)
0140  2 #ED-Z-KOMMENTAR (A32)
0150 END-DEFINE

USR1057L


0010 DEFINE DATA LOCAL
0020  1 V (I1)
0030 CONST<20>
0040  1 USR1057L
0050  2 OBJECT-KEY
0060  3 LIBRARY (A8)
0070  3 OBJECT-NAME (A32)
0080  3 OBJECT-TYPE (A2)
0090  2 INPUTS
0100  3 OPT-ACCESS (A1)
0110  3 OPT-UNUSED-1 (L)
0120  3 OPT-UNUSED-2 (A1)
0130  3 OPT-LINE-NUM (A1)
0140  3 OPT-UNUSED-3 (L)
0150  3 OPT-REDEF-DIR (L)
0160  3 OPT-UNUSED-4 (A1)
0170  3 OPT-AMOUNT (I2)
0180  3 OPT-LINESIZE (I2)
0190  2 INPUT-OUTPUTS
0200  3 INT-HANDLE (I4)
0210  3 NEXT-SEQ (I4)
0220  3 NEXT-NUM (I2)
0230  2 OUTPUTS
0240  3 RETURNED (I2)
0250  3 SRC-NUM (I2/1:20)
0260  3 SRC-TEXT (A1/1:20,1:88)
0270  3 REDEFINE SRC-TEXT
0280  4 SRC-GROUP (1:20)
0290  5 SRC-LINE (A88)
0300  5 REDEFINE SRC-LINE
0310  6 SRC-LINE-B (B20)
0320  3 SRC-SEQ (I4/1:20)
0330  3 SRC-LONG (A1/1:20)
0340 END-DEFINE

0010 DEFINE DATA
0020 LOCAL USING USR1057L
0030 LOCAL USING USR-MSG   /* Data for message exchange
0040 LOCAL USING USR-FLD   /* Description of the field in error
0050 LOCAL USING L-ED-Z
0060 LOCAL
0070 1 USR1057N
0080   2 VERSION          (I01)     INIT <2>
0090   2 V1-NSC-CKECK     (A01)
0100   2 V2-DBID          (N05)
0110   2 V2-FNR           (N04)
0120   2 V2-PSW           (A08)
0130   2 V2-CIP           (N08)
0140   2 V2-SYSFILE       (A01)
0150 1 REDEFINE USR1057N
0160   2 EXTENDED-PARMS
0170     3 EXTENDED-DATA  (A01/1:28)
0180 *
0190 01 #I (I4)
0200 01 #OUT (A100)
0210 01 #IDX-END-POS (I2)
0220 *
0230 01 #LIBRARY  (A8) INIT <'LVPT'> 
0240 01 #DATANAME (A8) INIT <'DLV81'>
0250 *
0260 END-DEFINE
0270 *
0280 INPUT (AD=MI) #LIBRARY #DATANAME
0290 *
0300 PERFORM WRITE-HTML-HEAD
0310 *
0320 PERFORM INIT-USR1057
0330 *
0340 OPT-ACCESS := 'O'
0350 PERFORM EXECUTE-USR1057
0360 *
0370 REPEAT
0380   OPT-ACCESS := 'R'
0390   PERFORM EXECUTE-USR1057
0400   FOR #I = 1 TO RETURNED
0410     IF SRC-NUM(#I) NE 0
0420       #ED-Z := SRC-LINE(#I)
0430 *      
0440       PERFORM WRITE-HTML-TABLE
0450 *      
0460     END-IF
0470   END-FOR
0480   IF MSG-NR NE 0
0490     ESCAPE BOTTOM
0500   END-IF
0510 END-REPEAT
0520 *
0530 * The following is Optional
0540 *
0550 OPT-ACCESS := 'C'
0560 PERFORM EXECUTE-USR1057
0570 *
0580 PERFORM WRITE-HTML-FOOTER
0590 *
0600 ************************************************************************
0610 *
0620 DEFINE SUBROUTINE WRITE-HTML-HEAD
0630 *
0640 #OUT := '<HTML>'
0650 PERFORM WRITE-TO-FILE
0660 #OUT := '<BODY>'
0670 PERFORM WRITE-TO-FILE
0680 #OUT := '<TABLE>'
0690 PERFORM WRITE-TO-FILE
0700 *
0710 END-SUBROUTINE /* WRITE-HTML-HEAD
0720 *
0730 ************************************************************************
0740 *
0750 DEFINE SUBROUTINE WRITE-HTML-TABLE
0760 *
0770 #OUT := '<TR>'
0780 PERFORM WRITE-TO-FILE
0790 #OUT := '<TD>'
0800 PERFORM WRITE-TO-FILE
0810 #OUT := #ED-Z-STUFE
0820 PERFORM WRITE-TO-FILE
0830 #OUT := '</TD>'
0840 PERFORM WRITE-TO-FILE
0850 #OUT := '<TD>'
0860 PERFORM WRITE-TO-FILE
0870 #OUT := #ED-Z-BEZEICHNER
0880 PERFORM WRITE-TO-FILE
0890 #OUT := '</TD>'
0900 PERFORM WRITE-TO-FILE
0910 #OUT := '<TD>'
0920 PERFORM WRITE-TO-FILE
0930 IF #ED-Z-ART = 'DK' OR = 'DF'
0940   COMPRESS #ED-Z-FORMAT #ED-Z-LAENGE
0950     INTO #OUT
0960     LEAVING NO
0970   PERFORM WRITE-TO-FILE
0980 ELSE
0990   #OUT := '&NBSP'
1000 END-IF
1010 #OUT := '</TD>'
1020 PERFORM WRITE-TO-FILE
1030 #OUT := '<TD>'
1040 PERFORM WRITE-TO-FILE
1050 IF SUBSTR(#ED-Z-KOMMENTAR,1,1) = '('
1060   EXAMINE #ED-Z-KOMMENTAR FOR ')'
1070     GIVING POSITION IN #IDX-END-POS
1080   #OUT := SUBSTR(#ED-Z-KOMMENTAR,1,#IDX-END-POS)
1090   PERFORM WRITE-TO-FILE
1100 ELSE
1110   #OUT := '&NBSP'
1120 END-IF
1130 #OUT := '</TD>'
1140 PERFORM WRITE-TO-FILE
1150 *
1160 END-SUBROUTINE /* WRITE-HTML-TABLE
1170 *
1180 ************************************************************************
1190 *
1200 DEFINE SUBROUTINE WRITE-HTML-FOOTER
1210 *
1220 #OUT := '</TABLE>'
1230 PERFORM WRITE-TO-FILE
1240 #OUT := '</BODY>'
1250 PERFORM WRITE-TO-FILE
1260 #OUT := '</HTML>'
1270 PERFORM WRITE-TO-FILE
1280 *
1290 END-SUBROUTINE /* WRITE-HTML-FOOTER
1300 *
1310 ************************************************************************
1320 *
1330 DEFINE SUBROUTINE WRITE-TO-FILE
1340 *
1350 WRITE WORK 01 VARIABLE #OUT
1360 RESET #OUT
1370 *
1380 END-SUBROUTINE /* WRITE-TO-FILE
1390 *
1400 ************************************************************************
1410 *
1420 DEFINE SUBROUTINE INIT-USR1057
1430 LIBRARY       := #LIBRARY
1440 OBJECT-NAME   := #DATANAME
1450 OPT-LINE-NUM  := 'Y'
1460 OPT-REDEF-DIR := FALSE
1470 OPT-AMOUNT    := 20
1480 OPT-LINESIZE  := 88
1490 END-SUBROUTINE /* INIT-USR1057
1500 *
1510 ************************************************************************
1520 *
1530 DEFINE SUBROUTINE EXECUTE-USR1057
1540 *
1550 CALLNAT 'USR1057N' USR1057L  USR1057N.EXTENDED-PARMS
1560   NAD-MSG   NAD-FLD
1570 *
1580 END-SUBROUTINE /* EXECUTE-USR1057
1590 *
1600 ************************************************************************
1610 END

Sorry for Codestyle but that was only a draft.

Greetings
Sascha

Okay!

I’ve to check (and understand) this first but thank you for the moment.

greetings
Steve