001000$CONTROL POST85,USLINIT,BOUNDS,LOCKING,LINES=58 001100 IDENTIFICATION DIVISION. 001200 PROGRAM-ID. TBASE. 001300 AUTHOR. D BECKER. 001400 DATE-WRITTEN. WED, DEC 19, 2001. 001500 DATE-COMPILED. 001600 001700*********************************************************** 001800* * 001900* This program accepts a database name and password; * 002000* * 002100* It is a CGI program interacting with an Apache Server * 002200* gathering information from a post in an html page * 002300* * 002400* * 002500* If the database can be opened (mode 5), the Image * 002600* intrisics are called to determine the characteristics * 002700* of the database. * 002800* * 002900* First, a summary of the datasets is shown; * 003000* Next, all the active items in the database are shown; * 003100* Finally, datasets are shown with their items and paths. * 003200* * 003300* Developers are advised that Chapter 5 of the TurboIMAGE * 003400* Database Management System Reference, Edition 7, is * 003500* vital to understand the DBINFO calls used to power * 003600* the program. * 003700* * 003800* Note that this program also checks to see if TPI is * 003900* present and if it is turned on, will account for * 004000* additional key fields used as indices by the Third * 004100* Party Index provider [note that OMNIDEX was used for * 004200* the model and SUPERDEX may not work the same way. * 004300* * 004400* The following CSMC script is provided to allow * 004500* program compilation [note: Use lower case!]: * 004600* 004700* PARM PROG,SUFF="CC" 004800* COB85XL !PROG!SUFF 004900* LINK $OLDPASS;TO=./!PROG;RL=/lib/libc.a ;posix ;share 005000* PURGE !PROG 005100* COPY ./!PROG , !PROG 005200* PURGE /APACHE/PUB/cgi-bin/!PROG 005300* COPY ./!PROG , /APACHE/PUB/cgi-bin/!PROG 005400* XEQ /SYS/HPBIN/CHMOD;INFO=" 777 /APACHE/PUB/cgi-bin/!PROG" 005500* 005600* Note that using :CSMC tbase works just fine * 005700* DON'T USE UPPER CASE ON tbase! * 005800* * 005900* * 006000*********************************************************** 006100 006200 ENVIRONMENT DIVISION. 006300 CONFIGURATION SECTION. 006400 006500 SOURCE-COMPUTER. HP-3000. 006600 OBJECT-COMPUTER. HP-3000. 006700 006800 SPECIAL-NAMES. 006900 CONDITION-CODE IS CC 007000 SYMBOLIC CHARACTERS NUL is 1, LF is 11, CR is 14. 007100 007200 DATA DIVISION. 007300 WORKING-STORAGE SECTION. 007400 77 XUB1 PIC S9(9) COMP VALUE 0. 007500 77 TPI-MODE PIC X VALUE " ". 007600 88 TPI-ON VALUE "9". 007700 007800 77 PATH-SW9 PIC X VALUE " ". 007900 88 PATH-SW VALUE "9". 008000 008100 77 GOAL PIC X(12) VALUE SPACES. 008200 77 DATELINE PIC X(28) VALUE SPACES. 008300 77 DZ PIC Z9-. 008400 008500 77 DISPLAY-TYPE PIC X(12) VALUE SPACES. 008600 008700 77 PARM-SIZE PIC S9(4) COMP VALUE 80. 008800 77 PARM-VALUE PIC S9(4) COMP VALUE 0. 008900 009000 1 INFO. 009100 5 INFO-X PIC X VALUE " ". 009200 5 INFO-R PIC X(79) VALUE " ". 009300 009400 01 PARM-INFO. 009500 5 PARM-INFO72 PIC X(72) VALUE " ". 009600 5 FILLER PIC X(8) VALUE " ". 009700 009800 77 WHO-MODE PIC S9(4) COMP VALUE 0. 009900 77 WHO-MODE1 PIC S9(4) COMP VALUE 0. 010000 77 WHO-USER PIC X(8) VALUE " ". 010100 77 WHO-ACCOUNT PIC X(8) VALUE " ". 010200 77 WHO-GROUP PIC X(8) VALUE " ". 010300 77 INFO-LENGTH PIC S9(4) COMP VALUE -80. 010400 010500 77 SUB PIC S9(4) COMP VALUE 0. 010600 77 SUB1 PIC S9(4) COMP VALUE 0. 010700 77 SUB2 PIC S9(4) COMP VALUE 0. 010800 77 SUB3 PIC S9(4) COMP VALUE 0. 010900 77 SUB4 PIC S9(4) COMP VALUE 0. 011000 77 SUB5 PIC S9(4) COMP VALUE 0. 011100 77 SUB6 PIC S9(4) COMP VALUE 0. 011200 77 SUB7 PIC S9(4) COMP VALUE 0. 011300 77 SUB8 PIC S9(4) COMP VALUE 0. 011400 77 SUB9 PIC S9(4) COMP VALUE 0. 011500 011600 77 INFO-IN PIC X VALUE " ". 011700 88 INFO-IN-OK VALUE " ". 011800 011900 77 DSPLY-ITM PIC ----9. 012000 012100 77 LINE-LENGTH PIC S9(4) COMP VALUE 256. 012200 77 NEG-LENGTH PIC S9(4) COMP VALUE -80. 012300 012400 77 DSPLY PIC ---,---,---,--9. 012500 012600 01 CTL-Y-FLAG PIC S9(4) COMP. 012700 01 Y-FLAG PIC X VALUE " ". 012800 012900 1 DISPLAY-LINE. 013000 5 DSPLY-LN OCCURS 1 TO 256 TIMES DEPENDING ON LINE-LENGTH 013100 PIC X. 013200 013300 1 SJW. 013400 3 SJW1. 013500 5 SJW-NUM PIC 9(4). 013600 5 SJW-XO. 013700 7 SJW-X PIC X. 013800 7 SJW-R1 PIC X(79). 013900 3 SJW2 REDEFINES SJW1. 014000 5 SJW-X2 PIC X. 014100 5 SJW-R3 PIC X(83). 014200 014300 77 UPPER PIC X(26) VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ". 014400 77 LOWER PIC X(26) VALUE "abcdefghijklmnopqrstuvwxyz". 014500 014600 1 QUALIFIER. 014700 3 BUFFER. 014800 05 Q0 OCCURS 256 TIMES PIC S9(4) COMP VALUE 0. 014900 3 XITEMS. 015000 05 I0 OCCURS 1024 TIMES PIC S9(4) COMP VALUE 0. 015100 3 DATASET-ITEMS. 015200 05 DI OCCURS 1024 TIMES PIC S9(4) COMP VALUE 0. 015300 3 ITEM-DATASETS. 015400 05 IM OCCURS 256 TIMES PIC S9(4) COMP VALUE 0. 015500 3 TPIITEMS. 015600 05 TPI1 PIC S9(4) COMP VALUE 0. 015700 05 TPIO OCCURS 1024 TIMES PIC S9(4) COMP VALUE 0. 015800 015900 1 SK. 016000 3 SKO OCCURS 256 TIMES. 016100 5 SKI PIC 9(4) COMP VALUE 0. 016200 5 SKM PIC 9(4) COMP VALUE 0. 016300 016400 1 SEARCH-KEY. 016500 3 SEARCH-KEY-ITEM PIC 9(4) COMP VALUE 0. 016600 3 SEARCH-KEY-MASTER PIC 9(4) COMP VALUE 0. 016700 016800 1 PATHS. 016900 05 PATH-NO PIC 9(4) COMP VALUE 0. 017000 05 PATH-OCCURS OCCURS 16 TIMES. 017100 7 PATH-KEY PIC 9(4) COMP VALUE 0. 017200 7 PATH-SEARCH PIC 9(4) COMP VALUE 0. 017300 7 PATH-SORT PIC 9(4) COMP VALUE 0. 017400 017500 01 BASE. 017600 03 BASE-ID PIC X(2) VALUE SPACES. 017700 03 BASE-NAME PIC X(26) VALUE "TEST.BASE.DEVEL;". 017800 017900 01 PASSWORD PIC X(9) VALUE "ABC123;". 018000 018100 01 DUMMY PIC X(2) VALUE SPACES. 018200 018300 01 ALL-LIST PIC X(2) VALUE "@;". 018400 018500 01 SAME-LIST PIC X(2) VALUE "*;". 018600 018700 01 STAT. 018800 03 DBS-IMAGE. 018900 05 IMAGE-STATUS PIC S9(4) COMP VALUE 0. 019000 05 ENTRYLEN PIC S9(4) COMP VALUE 0. 019100 05 RECDNUMB PIC S9(9) COMP VALUE 0. 019200 05 CHAINLEN PIC S9(9) COMP VALUE 0. 019300 05 BACKPOINT PIC S9(9) COMP VALUE 0. 019400 05 FORWPOINT PIC S9(9) COMP VALUE 0. 019500 019600 01 DB-MODES. 019700 03 MODE1 PIC S9(4) COMP VALUE 1. 019800 03 MODE2 PIC S9(4) COMP VALUE 2. 019900 03 MODE3 PIC S9(4) COMP VALUE 3. 020000 03 MODE4 PIC S9(4) COMP VALUE 4. 020100 03 MODE5 PIC S9(4) COMP VALUE 5. 020200 03 MODE6 PIC S9(4) COMP VALUE 6. 020300 03 MODE7 PIC S9(4) COMP VALUE 7. 020400 03 MODE8 PIC S9(4) COMP VALUE 8. 020500 03 MODE102 PIC S9(4) COMP VALUE 102. 020600 03 MODE103 PIC S9(4) COMP VALUE 103. 020700 03 MODE104 PIC S9(4) COMP VALUE 104. 020800 03 MODE202 PIC S9(4) COMP VALUE 202. 020900 03 MODE203 PIC S9(4) COMP VALUE 203. 021000 03 MODE204 PIC S9(4) COMP VALUE 204. 021100 03 MODE301 PIC S9(4) COMP VALUE 301. 021200 03 MODE302 PIC S9(4) COMP VALUE 302. 021300 03 MODE801 PIC S9(4) COMP VALUE 801. 021400 03 MODE802 PIC S9(4) COMP VALUE 802. 021500 03 MODE812 PIC S9(4) COMP VALUE 812. 021600 03 MODE813 PIC S9(4) COMP VALUE 813. 021700 03 MODE814 PIC S9(4) COMP VALUE 814. 021800 03 MODE821 PIC S9(4) COMP VALUE 821. 021900 03 MODE832 PIC S9(4) COMP VALUE 832. 022000 022100 1 TPI-DATA. 022200 5 TPI-PRODUCT PIC X(40) VALUE SPACES. 022300 5 TPI-VERSION PIC X(10) VALUE SPACES. 022400 5 TPI-INSTALLED PIC S9(4) COMP VALUE 0. 022500 5 FILLER PIC S9(4) COMP VALUE 0. 022600 5 TPI-TIME PIC S9(9) COMP VALUE 0. 022700 022800 01 DS-USERID-M PIC X(9) VALUE "USERID-M;". 022900 023000 01 DB-USERID-M. 023100 03 USERID PIC X(8) VALUE SPACES. 023200 03 ACCT PIC X(8) VALUE SPACES. 023300 023400 01 DS-SORT-KEY-A PIC X(11) VALUE "SORT-KEY-A;". 023500 023600 01 DB-SORT-KEY-A. 023700 03 SORT-KEY PIC X(2) VALUE SPACES. 023800 023900 01 DS-JOB-DEF-D PIC X(10) VALUE "JOB-DEF-D;". 024000 024100 01 DB-JOB-DEF-D. 024200 03 USERID PIC X(8) VALUE SPACES. 024300 03 ACCT PIC X(8) VALUE SPACES. 024400 03 CHANGE-INDIC PIC X(2) VALUE SPACES. 024500 03 SORT-KEY PIC X(2) VALUE SPACES. 024600 03 INTR-NUM PIC 9(6) VALUE ZEROS. 024700 03 PARM-CNT PIC S9(4) COMP VALUE 0. 024800 03 SCND-OPERAND PIC S9(9) COMP VALUE 0. 024900 025000 01 DI-USERID PIC X(7) VALUE "USERID;". 025100 025200 01 DI-SORT-KEY PIC X(9) VALUE "SORT-KEY;". 025300 025400 01 LIST. 025500 03 LIST-1 PIC X(65) VALUE "@;". 025600 025700 77 SS-PTR1 PIC S9(4) COMP VALUE 0. 025800 77 SS-PTR2 PIC S9(4) COMP VALUE 0. 025900 77 SS-PTR3 PIC S9(4) COMP VALUE 0. 026000 77 SS-PTR4 PIC S9(4) COMP VALUE 0. 026100 77 SS-PTR5 PIC S9(4) COMP VALUE 0. 026200 77 SS-PTR6 PIC S9(4) COMP VALUE 0. 026300 026400 01 DS-TABLE. 026500 5 DATA-SET-TABLE OCCURS 256 TIMES PIC X(16) VALUE SPACES. 026600 5 DATA-SET-REF OCCURS 256 TIMES PIC S9(4) COMP VALUE 0. 026700 026800 01 SSS-TABLE. 026900 5 SSS-OCCURS OCCURS 256 TIMES. 027000 027100 7 SET-INFO. 027200 9 DATA-SET-NAME PIC X(16) VALUE SPACES. 027300 9 SSS-KEY REDEFINES DATA-SET-NAME PIC X(16). 027400 9 SSS-KEYC REDEFINES DATA-SET-NAME PIC X(16). 027500 9 SSS-REST. 027600 11 SSS-RESTC. 027700 19 DATA-SET-TYPE PIC XX VALUE SPACES. 027800 19 DATA-SET-ENTRY-LENGTH PIC S9(4) COMP VALUE 0. 027900 19 DATA-SET-BLOCKING-FACTOR PIC S9(4) COMP VALUE 0. 028000 19 DATA-SET-ORIGINAL-NUMBER PIC S9(4) COMP VALUE 0. 028100 19 FILLER PIC S9(4) COMP VALUE 0. 028200 19 DATA-SET-ENTRIES PIC S9(9) COMP VALUE 0. 028300 19 DATA-SET-CAPACITY PIC S9(9) COMP VALUE 0. 028400 028500 01 DSHEAD. 028600 5 FILLER PIC XXX VALUE "". 028700 5 FILLER PIC X(28) VALUE 028800 ' Data set name'. 028900 5 FILLER PIC X(10) VALUE ' Type '. 029000 5 FILLER PIC X(8) VALUE 'Length'. 029100 5 FILLER PIC X(11) VALUE ' Records'. 029200 5 FILLER PIC X(12) VALUE ' Capacity '. 029300 5 FILLER PIC X(6) VALUE ' %Full'. 029400 5 FILLER PIC X(4) VALUE ''. 029500 5 FILLER PIC X VALUE CR. 029600 5 FILLER PIC X VALUE LF. 029700 029800 1 DSLINE. 029900 5 DSTYPE PIC X(9) VALUE " ". 030000 5 DSRECSZ PIC ZZZ,ZZ9-. 030100 5 DSENTRIES PIC ZZZ,ZZZ,ZZ9-. 030200 5 DSCAPACITY PIC ZZZ,ZZZ,ZZ9-. 030300 5 FILLER PIC X(14) VALUE ''. 030800 5 DSPERCENT PIC ZZ9.9. 030900 5 FILLER PIC X VALUE '%'. 031000 5 FILLER PIC X(7) VALUE ''. 031100 5 FILLER PIC X VALUE CR. 031200 5 FILLER PIC X VALUE LF. 031300 031400 77 DS-PERCENT PIC 999V9 COMP VALUE 0. 031500 031600 1 SORT-RECORD. 031700 5 SORT-KEY. 031800 7 SORT-KEYC PIC X(16). 031900 032000 5 SORT-REST. 032100 7 SORT-RESTC PIC X(20). 032200 032300 77 SORT-IND PIC X VALUE "0". 032400 88 SORT-END VALUE "9". 032500 032600 77 XS-PTR1 PIC S9(4) COMP VALUE 0. 032700 77 XS-PTR2 PIC S9(4) COMP VALUE 0. 032800 77 XS-PTR3 PIC S9(4) COMP VALUE 0. 032900 77 XS-PTR4 PIC S9(4) COMP VALUE 0. 033000 77 XS-PTR5 PIC S9(4) COMP VALUE 0. 033100 77 XS-PTR6 PIC S9(4) COMP VALUE 0. 033200 033300 77 XSS-TEMP-PROPERTIES PIC X(11). 033400 033500 01 ITEM-NAME-WORK. 033600 5 ITEM-NAMEN PIC X(60) VALUE SPACES. 033700 033800 01 XSS-DISPLAY-TABLE. 033900 3 XSS-DISPLAY OCCURS 1024 TIMES. 034000 5 XSS-ITEM PIC X(17) VALUE SPACES. 034100 5 XSS-PROPERTIES PIC X(11) VALUE SPACES. 034200 034300 01 XSS-TABLE. 034400 5 XSS-OCCURS OCCURS 1024 TIMES. 034500 7 ITEM-INFO. 034600 9 ITEM-NAME PIC X(16) VALUE SPACES. 034700 9 XSS-REST. 034800 11 XSS-RESTC. 034900 13 ITEM-TYPE PIC XX VALUE SPACES. 035000 13 ITEM-LENGTH PIC S9(4) COMP VALUE 0000. 035100 13 ITEM-COUNT PIC S9(4) COMP VALUE 0. 035200 13 ITEM-ORIGINAL PIC S9(4) COMP VALUE 0. 035300 13 FILLER PIC S9(4) COMP VALUE 0. 035400 035500 1 TXSS-HEAD. 035600 5 TXSSHEAD PIC X(22) VALUE 'Omnidex Items:'. 035700 5 FILLER PIC X VALUE CR. 035800 5 FILLER PIC X VALUE LF. 035900 5 FILLER PIC X VALUE CR. 036000 5 FILLER PIC X VALUE LF. 036100 036200 01 TXSS-DISPLAY-TABLE. 036300 3 TXSS-DISPLAY. 036400 5 TXSS-ITEM PIC X(17) VALUE SPACES. 036500 5 TXSS-PROPERTIES PIC X(11) VALUE SPACES. 036600 036700 01 TXSS-TABLE. 036800 5 TXSS-OCCURS. 036900 7 TITEM-INFO. 037000 9 TITEM-NAME PIC X(16) VALUE SPACES. 037100 9 TXSS-REST. 037200 11 TXSS-RESTC. 037300 13 TITEM-TYPE PIC XX VALUE SPACES. 037400 13 TITEM-LENGTH PIC S9(4) COMP VALUE 0000. 037500 13 TITEM-COUNT PIC S9(4) COMP VALUE 0. 037600 13 TITEM-KTYPE PIC S9(4) COMP VALUE 0. 037700 13 FILLER PIC S9(4) COMP VALUE 0. 037800 037900 1 XORT-RECORD. 038000 5 XORT-KEY. 038100 7 XORT-KEYC PIC X(16). 038200 038300 5 XORT-REST. 038400 7 XORT-RESTC PIC X(10). 038500 038600 77 XORT-IND PIC X VALUE "0". 038700 88 XORT-END VALUE "9". 038800 038900 77 NR-PREFIX1 PIC X(5) VALUE "summ_". 039000 77 NR-PREFIX2 PIC X(5) VALUE "href_". 039100 77 NR-NAME PIC X(32) VALUE SPACES. 039200 039300 1 NAME-REF. 039400 5 FILLER PIC X(9) VALUE '". 039900 5 NRNAME PIC X(32) VALUE SPACES. 040000 040100 1 ITEM-REF. 040200 5 FILLER PIC X(3) VALUE '". 040700 5 ITEMREF2 PIC X(30) VALUE SPACES. 040800 5 ITEMTYPE PIC X(8) VALUE SPACES. 040900 5 ITEMCHAR PIC X(80) VALUE SPACES. 041000 041100 041200 1 SET-IN-ITEM. 041300 5 FILLER PIC X(5) VALUE '
  • '. 041400 5 FILLER PIC X(15) VALUE '". 041700 5 SIIN1 PIC X(20) VALUE SPACES. 041800 5 FILLER PIC X VALUE "[". 041900 5 SIIT PIC X(9) VALUE SPACES. 042000 5 FILLER PIC XXX VALUE "]". 042100 5 SIIK PIC X(18) VALUE SPACES. 042200 5 FILLER PIC X VALUE CR. 042300 5 FILLER PIC X VALUE LF. 042400 042500 77 STATIONID PIC X(32) VALUE SPACES. 042600 77 TCPIP PIC X(32) VALUE SPACES. 042700 042800 042900 1 QUERY-TEXT. 043000 5 FILLER PIC X(16) VALUE "

    QUERY_TEXT = ". 043100 5 QUERYTEXT PIC X(256) VALUE SPACES. 043200 5 FILLER PIC X(5) VALUE "

    ". 043300 5 FILLER PIC X VALUE CR. 043400 5 FILLER PIC X VALUE LF. 043500 043600* buffers for reading env vars via getenv() from Posix C lib 043700 043800 01 env-name PIC X(80). 043900 01 env-pointer PIC S9(9) COMP. 044000 01 env-text PIC X(80). 044100 01 env-length PIC S9(9) COMP. 044200 044300* counter for the test loop writing lines back to client 044400 044500 01 loop-count PIC 9(9). 044600 044700* buffers for reading client input from stdin (Method POST) 044800 044900 01 post-length PIC s9(9) COMP. 045000 01 post-buf PIC x(256). 045100 01 post-get PIC s9(9) COMP. 045200 01 post-got PIC 9(9). 045300 01 post-pos PIC s9(9) COMP. 045400 045500* buffers for extracting "field1=value1&field2=value2..." 045600 045700 01 field-name PIC x(80). 045800 01 field-name-len PIC s9(9) COMP. 045900 01 field-value PIC x(80). 046000 01 field-value-len PIC s9(9) COMP. 046100 046200* message for the test loop (only passed WITH Method POST) 046300 046400 01 test-msg PIC x(80). 046500 01 test-msg-len PIC s9(9) COMP. 046600 046700 01 CRLF. 046800 5 FILLER PIC X VALUE CR. 046900 5 FILLER PIC X VALUE LF. 047000 047100 77 H1 PIC X(24) VALUE ''. 047200 77 HTOP PIC X(14) VALUE '
    '. 047300 77 H2 PIC X(41) VALUE 047400 '

    '. 047500 77 H3 PIC X(24) VALUE 'Database Cross Reference'. 047600 77 H4 PIC X(12) VALUE '

    '. 047700 77 HF1 PIC X(45) VALUE 047800 '

    '. 047900 77 HF2 PIC X(15) VALUE 'Database: '. 048000 77 HF3 PIC X(53) VALUE 048100 '
    '. 048200 77 HF4 PIC X(15) VALUE 'Password: '. 048300 77 HF5 PIC X(53) VALUE 048400 '

    '. 048500 77 HF6 PIC X(12) VALUE "
    ". 048600 77 HF7 PIC X(46) VALUE 048700 ''. 048800 77 HF8 PIC X(46) VALUE 048900 ''. 049000 77 HF9 PIC X(13) VALUE '
    '. 049100 77 HEFORM PIC X(7) VALUE "
    ". 049200 049300 01 HREFS. 049400 05 FILLER PIC X(25) VALUE '

     


    '. 050300 05 FILLER PIC X VALUE CR. 050400 05 FILLER PIC X VALUE LF. 050500 050600 050700 77 UNSTRING1 PIC X(32) VALUE SPACES. 050800 77 UNSTRING1N PIC X(20) VALUE SPACES. 050900 77 UNSTRING2 PIC X(32) VALUE SPACES. 051000 77 UNSTRING2N PIC X(20) VALUE SPACES. 051100 77 UNSTRING3 PIC X(12) VALUE SPACES. 051200 77 UNSTRING3N PIC X(20) VALUE SPACES. 051300 77 UNSTRING4 PIC X(12) VALUE SPACES. 051400 77 UNSTRING4N PIC X(20) VALUE SPACES. 051500 77 UNSTRING5 PIC X(8) VALUE SPACES. 051600 77 UNSTRING5N PIC X(20) VALUE SPACES. 051700 77 UNSTRING6 PIC X(80) VALUE SPACES. 051800 77 UNSTRING6N PIC X(80) VALUE SPACES. 051900 77 UNSTRING7 PIC X(80) VALUE SPACES. 052000 052100 PROCEDURE DIVISION. 052200 STARTING SECTION. 052300 STARTING-HERE. 052400 CALL INTRINSIC "GETINFO" USING PARM-INFO, PARM-SIZE, 052500 PARM-VALUE. 052600 052700 CALL INTRINSIC "WHO" USING WHO-MODE \\ \\ 052800 WHO-USER, WHO-GROUP, WHO-ACCOUNT. 052900 053000 DIVIDE 4 INTO WHO-MODE. 053100 053200 MOVE PARM-INFO TO INFO. 053300 053400 PERFORM JUSTIFY-INFO. 053500 053600 DISPLAY "Content-Type: text/html" CR LF CR LF 053700 053800 PERFORM GET-VARIABLES 053900 054000* DISPLAY "" CR LF CR LF. 054100 054200* Set up heading: 054300 DISPLAY H1 CRLF HTOP CRLF H2 H3 H4 CRLF. 054400 054500 054600 DISPLAY 054700 '
  • Datasets Summary' CRLF. 054800 DISPLAY 054900 '
  • Items' CRLF. 055000 DISPLAY 055100 '
  • Datasets' CRLF. 055200 055300* Set up form: 055400 DISPLAY HF1 CRLF. 055500 DISPLAY HF2 CRLF. 055600 DISPLAY HF3 CRLF. 055700 DISPLAY HF4 CRLF. 055800 DISPLAY HF5 '

    ' CRLF. 055900 DISPLAY HF6 CRLF. 056000 DISPLAY HF6 '

    ' CRLF. 056100 056200 DISPLAY HF7 CRLF. 056300 DISPLAY HF8 '

    ' CRLF. 056400 DISPLAY HF9 CRLF. 056500 DISPLAY HF9 CRLF. 056600 056700 DISPLAY HEFORM CRLF. 056800 056900 CALL INTRINSIC "DATELINE" USING DATELINE. 057000 DISPLAY 'Cross Reference for ' BASE-NAME ' - ' 057100 DATELINE. 057200 057300 DISPLAY "
    " CR LF.
    057400
    057500     DISPLAY HREFS.
    057600
    057700     CALL "DBOPEN" USING BASE, PASSWORD, MODE5, STAT.
    057800
    057900     IF IMAGE-STATUS NOT = 0
    058000        DISPLAY "Database " BASE-NAME
    058100*        " pass=" PASSWORD
    058200                " not opened" CRLF
    058300
    058400        PERFORM DBEXPLAIN
    058500
    058600       ELSE
    058700
    058800         PERFORM BASIC-PROGRAM.
    058900
    059000     DISPLAY ""  CR LF
    059100     DISPLAY ""  CR LF.
    059200
    059300     STOP RUN.
    059400
    059500 TPI.
    059600    INITIALIZE TPI-DATA.
    059700    CALL "DBINFO" USING BASE, QUALIFIER, MODE801, STAT,
    059800       TPI-DATA.
    059900
    060000    IF IMAGE-STATUS NOT = 0 OR TPI-PRODUCT = SPACES
    060100        DISPLAY "No Third Party Indexing (TPI) on  "
    060200           BASE-NAME '' CRLF
    060300      ELSE
    060400        CALL "DBINFO" USING BASE, QUALIFIER, MODE802, STAT,
    060500          SUB
    060600        IF IMAGE-STATUS NOT = 0 PERFORM DBEXPLAIN
    060700         ELSE
    060800        IF SUB > 0
    060900        DISPLAY "TPI Enabled: " TPI-PRODUCT CRLF
    061000        DISPLAY "    Version: " TPI-VERSION CRLF
    061100        SET TPI-ON TO TRUE
    061200         ELSE
    061300        DISPLAY "TPI Disabled: " TPI-PRODUCT CRLF
    061400        DISPLAY "     Version: " TPI-VERSION CRLF.
    061500
    061600*   IF TPI-ON
    061700*       MOVE 813 TO MODE103
    061800*       MOVE 814 TO MODE104.
    061900
    062000 GET-VARIABLES.
    062100*   Get the information from the post:
    062200
    062300     STRING "SERVER_SOFTWARE", NUL
    062400       DELIMITED BY SIZE INTO ENV-NAME.
    062500
    062600     PERFORM MY-GETENV.
    062700
    062800     STRING "REMOTE_ADDR", NUL
    062900       DELIMITED BY SIZE INTO ENV-NAME.
    063000
    063100     PERFORM MY-GETENV.
    063200
    063300     STRING ENV-TEXT DELIMITED BY NUL
    063400        INTO TCPIP.
    063500
    063600     STRING "REQUEST_METHOD" NUL
    063700       DELIMITED BY SIZE INTO env-name.
    063800
    063900     PERFORM my-getenv.
    064000
    064100     STRING "CONTENT_LENGTH" NUL
    064200       DELIMITED BY SIZE INTO env-name.
    064300
    064400     PERFORM my-getenv.
    064500
    064600*    DISPLAY "

    POST Method received CONTENT_LENGTH as " 064700* env-text (1 : env-length) "

    " CR LF. 064800 064900 IF env-length = 0 then 065000 065100 DISPLAY "

    GET Method needs valid QUERY_STRING

    " CR LF. 065200 065300* ELSE 065400 065500* DISPLAY "

    GET Method received QUERY_STRING as " 065600* env-text (1:env-length) "

    " CR LF. 065700 065800 COMPUTE post-length = function numval (env-text) 065900 066000 IF post-length > function length (post-buf) then 066100 066200 DISPLAY "

    Too much DATA for my POST buffer

    " CR LF 066300 066400 ELSE 066500 066600 COMPUTE post-get = - post-length 066700 066800 CALL intrinsic "readx" 066900 USING post-buf , post-get GIVING post-got. 067000 067100* DISPLAY "

    Received " post-got " bytes WITH " 067200* post-buf (1 : post-got) "

    " CR LF. 067300 067400 MOVE POST-BUF (1 : POST-GOT) TO QUERYTEXT. 067500 067600 INSPECT QUERYTEXT REPLACING ALL "+" BY SPACES. 067700 INSPECT QUERYTEXT REPLACING ALL CR BY SPACES. 067800 INSPECT QUERYTEXT REPLACING ALL LF BY SPACES. 067900 INSPECT QUERYTEXT REPLACING ALL NUL BY SPACES. 068000 INSPECT QUERYTEXT REPLACING ALL LOW-VALUES BY SPACES. 068100 INSPECT QUERYTEXT REPLACING ALL HIGH-VALUES BY SPACES. 068200 068300* DISPLAY QUERY-TEXT. 068400 068500 UNSTRING QUERYTEXT 068600 DELIMITED BY "database=" OR "&password=" OR 068700 "&B1=" OR "&R1=" 068800 INTO UNSTRING1 DELIMITER IN UNSTRING2N 068900 UNSTRING2 DELIMITER IN UNSTRING3N 069000 UNSTRING3 DELIMITER IN UNSTRING4N 069100 UNSTRING4 DELIMITER IN UNSTRING5N 069200 UNSTRING5 DELIMITER IN UNSTRING6N 069300 ON OVERFLOW 069400 DISPLAY "

    Unstring Overflow Occured

    " cr lf. 069500 069600* DISPLAY "UNSTRING1 =" UNSTRING1 CRLF. 069700* DISPLAY "UNSTRING2N=" UNSTRING2N CRLF. 069800 069900* DISPLAY "UNSTRING2 =" UNSTRING2 CRLF. 070000* DISPLAY "UNSTRING3N=" UNSTRING3N CRLF. 070100 070200* DISPLAY "UNSTRING3 =" UNSTRING3 CRLF. 070300* DISPLAY "UNSTRING4N=" UNSTRING4N CRLF. 070400 070500 070600* DISPLAY "UNSTRING4 =" UNSTRING4 CRLF. 070700* DISPLAY "UNSTRING5N=" UNSTRING5N CRLF. 070800 070900 071000* DISPLAY "UNSTRING5 =" UNSTRING5 CRLF. 071100* DISPLAY "UNSTRING6N=" UNSTRING6N CRLF. 071200 071300 IF UNSTRING2 NOT = SPACES MOVE UNSTRING2 TO BASE-NAME. 071400 IF UNSTRING3 NOT = SPACES MOVE UNSTRING3 TO PASSWORD. 071500 071600 071700 BASIC-PROGRAM. 071800 PERFORM TPI. 071900 DISPLAY '
    '. 072000 DISPLAY '

    Datasets Summary:

    ' CRLF. 072100 072200* Get all dataset names, store in table, sort in order: 072300 PERFORM DBINFO-CALL203. 072400 072500* Display datasets in database in summary format: 072600 072700 PERFORM DISPLAY-DATA-SETS Q0 (1) TIMES. 072800 DISPLAY HREFS. 072900 DISPLAY "
    ". 073000 073100* Display items in database: 073200 DISPLAY '

    Items

    ' CRLF. 073300 PERFORM DBINFO-CALL103. 073400 DISPLAY HREFS. 073500 DISPLAY "
    ". 073600 DISPLAY '

    Datasets:

    ' CRLF. 073700 DISPLAY "------- DATA SETS and Items " 073800 'for ' BASE-NAME "
    " CRLF. 073900 MOVE "href_" TO NR-PREFIX1. 074000 MOVE "summ_" TO NR-PREFIX2. 074100 074200 MOVE 0 TO SS-PTR6. 074300 074400* Display datasets with items and paths: 074500 PERFORM DISPLAY-DATA-SET-ITEMS Q0 (1) TIMES. 074600 DISPLAY HREFS. 074700 DISPLAY "
    ". 074800 DISPLAY "

    End.

    ". 074900 075000 CALL "DBCLOSE" USING BASE, DS-JOB-DEF-D, MODE1, STAT. 075100 075200 IF IMAGE-STATUS NOT = 0 PERFORM DBEXPLAIN. 075300 075400 DBEXPLAIN. 075500 CALL "DBEXPLAIN" USING STAT. 075600 075700 DBINFO-CALL203. 075800 CALL "DBINFO" USING BASE, QUALIFIER, MODE203, STAT, 075900 BUFFER. 076000 076100 DISPLAY Q0 (1) " Sets in Database " BASE-NAME 076200 '
    ' CR LF. 076300 DISPLAY DSHEAD. 076400 076500 MOVE 1 TO SUB. 076600 076700 PERFORM DBINFO-CALL202 Q0 (1) TIMES. 076800 076900 PERFORM SORT-START. 077000 077100 DBINFO-CALL202. 077200 ADD 1 TO SUB. 077300 ADD 1 TO SS-PTR1. 077400 077500 CALL "DBINFO" USING BASE, Q0 (SUB), MODE202, STAT, 077600 SET-INFO (SS-PTR1). 077700 077800 MOVE Q0 (SUB) TO DATA-SET-ORIGINAL-NUMBER (SS-PTR1). 077900 078000 MOVE Q0 (SUB) TO SUB2. 078100 078200 MOVE DATA-SET-NAME (SS-PTR1) TO DATA-SET-TABLE (SUB2). 078300 078400 078500 DISPLAY-DATA-SET-ITEMS. 078600 ADD 1 TO SS-PTR6. 078700 078800 MOVE "href_" TO NR-PREFIX1. 078900 MOVE "summ_" TO NR-PREFIX2. 079000 079100 MOVE DATA-SET-NAME (SS-PTR6) TO NR-NAME. 079200 079300 PERFORM NR-PROCESSING. 079400 079500 COMPUTE SUB2 = DATA-SET-ENTRY-LENGTH (SS-PTR6) * 2. 079600 079700 MOVE SUB2 TO DSRECSZ. 079800 079900 MOVE SPACES TO DSTYPE. 080000 080100 IF DATA-SET-TYPE (SS-PTR6) = "M" OR "m" 080200 MOVE "Master" TO DSTYPE ELSE 080300 IF DATA-SET-TYPE (SS-PTR6) = "D" OR "d" 080400 MOVE "Detail" TO DSTYPE ELSE 080500 IF DATA-SET-TYPE (SS-PTR6) = "a" OR "A" 080600 MOVE "Automatic" TO DSTYPE. 080700 080800 MOVE DATA-SET-NAME (SS-PTR6) TO NR-NAME. 080900 PERFORM NR-PROCESSING. 081000 081100 MOVE DATA-SET-ENTRIES (SS-PTR6) TO DSENTRIES. 081200 MOVE DATA-SET-CAPACITY (SS-PTR6) TO DSCAPACITY. 081300 081400 SET BLACK TO TRUE. 081500 081600 MOVE 0 TO DS-PERCENT. 081700 081800 IF DATA-SET-CAPACITY (SS-PTR6) > 0 081900 COMPUTE DS-PERCENT ROUNDED = 082000 DATA-SET-ENTRIES (SS-PTR6) / 082100 DATA-SET-CAPACITY (SS-PTR6) * 100. 082200 082300 IF DATA-SET-CAPACITY (SS-PTR6) = DATA-SET-ENTRIES (SS-PTR6) 082400 MOVE 100 TO DSPERCENT. 082500 082600 IF DS-PERCENT > 74.9 SET RED TO TRUE. 082700 082800 MOVE DS-PERCENT TO DSPERCENT. 082900 083000 DISPLAY DSHEAD. 083100 DISPLAY NAME-REF, DSLINE. 083200 083300 MOVE LOW-VALUES TO PATHS. 083400 083500 CALL "DBINFO" USING BASE, DATA-SET-NAME (SS-PTR6), MODE301, 083600 STAT, PATHS. 083700 083800 CALL "DBINFO" USING BASE, DATA-SET-NAME (SS-PTR6), MODE302, 083900 STAT, SEARCH-KEY. 084000 084100 084200 PERFORM DBINFO-CALL104. 084300 084400 MOVE 0 TO SUB1. 084500 084600 IF PATH-NO > 0 PERFORM DISPLAY-PATH. 084700 084800 DISPLAY " " CR LF. 084900 085000 DISPLAY-PATH. 085100 DISPLAY " " CR LF. 085200 DISPLAY " PATHS:" CR LF. 085300 085400 PERFORM DISPLAY-PATHS PATH-NO TIMES. 085500 DISPLAY " " CR LF. 085600 085700 DISPLAY-PATHS. 085800 ADD 1 TO SUB1. 085900* PATH-KEY ---> SUB2 086000* PATH-SEARCH ---> SUB3 086100* PATH-SORT ---> SUB4 086200 086300 MOVE SUB1 TO DZ. 086400 MOVE PATH-KEY (SUB1) TO SUB2. 086500 MOVE PATH-SEARCH (SUB1) TO SUB3. 086600 MOVE PATH-SORT (SUB1) TO SUB4. 086700 086800 IF SUB2 > 0 086900 IF SUB3 > 0 087000 STRING " Path #" DZ 087100 '
    ' 087300 DATA-SET-TABLE (SUB2) '.' DELIMITED BY SPACE 087400 '' 087600 ITEM-NAME (SUB3) '' DELIMITED BY SPACE 087700 INTO DISPLAY-LINE 087800 PERFORM LISTOUT. 087900 088000 IF SUB2 > 0 088100 IF SUB4 > 0 088200 STRING " Path #" DZ 088300 '' 088500 DATA-SET-TABLE (SUB2) '.' DELIMITED BY SPACE 088600 '' 088800 ITEM-NAME (SUB4) '' DELIMITED BY SPACE 088900 INTO DISPLAY-LINE 089000 PERFORM LISTOUT. 089100 089200 089300 DISPLAY-DATA-SETS. 089400 ADD 1 TO SS-PTR6. 089500 089600 MOVE DATA-SET-ORIGINAL-NUMBER (SS-PTR6) TO SUB8. 089700 089800 MOVE SS-PTR6 TO DATA-SET-REF (SUB8). 089900 090000 COMPUTE SUB2 = DATA-SET-ENTRY-LENGTH (SS-PTR6) * 2. 090100 090200 MOVE SUB2 TO DSRECSZ. 090300 090400 MOVE SPACES TO DSTYPE. 090500 090600 IF DATA-SET-TYPE (SS-PTR6) = "M" OR "m" 090700 MOVE "Master" TO DSTYPE ELSE 090800 IF DATA-SET-TYPE (SS-PTR6) = "D" OR "d" 090900 MOVE "Detail" TO DSTYPE ELSE 091000 IF DATA-SET-TYPE (SS-PTR6) = "a" OR "A" 091100 MOVE "Automatic" TO DSTYPE. 091200 091300 MOVE DATA-SET-NAME (SS-PTR6) TO NR-NAME. 091400 PERFORM NR-PROCESSING. 091500 091600 MOVE DATA-SET-ENTRIES (SS-PTR6) TO DSENTRIES. 091700 MOVE DATA-SET-CAPACITY (SS-PTR6) TO DSCAPACITY. 091800 091900 SET BLACK TO TRUE. 092000 092100 MOVE 0 TO DS-PERCENT. 092200 092300 IF DATA-SET-CAPACITY (SS-PTR6) > 0 092400 COMPUTE DS-PERCENT ROUNDED = 092500 DATA-SET-ENTRIES (SS-PTR6) / 092600 DATA-SET-CAPACITY (SS-PTR6) * 100. 092700 092800 IF DATA-SET-CAPACITY (SS-PTR6) = DATA-SET-ENTRIES (SS-PTR6) 092900 MOVE 100 TO DSPERCENT. 093000 093100 IF DS-PERCENT > 74.9 SET RED TO TRUE. 093200 093300 MOVE DS-PERCENT TO DSPERCENT. 093400 093500 DISPLAY NAME-REF, DSLINE. 093600 093700 IF SS-PTR6 > 256 OR < 1 093800 MOVE SS-PTR6 TO DSPLY 093900 DISPLAY DSPLY '= ' DATA-SET-NAME (SS-PTR6) 094000 ELSE 094100 CALL "DBINFO" USING BASE, DATA-SET-NAME (SS-PTR6), MODE302, 094200 STAT, SKO (SS-PTR6). 094300 094400 DISPLAY-ITEMS. 094500 ADD 1 TO SUB9. 094600 MOVE I0 (SUB9) TO XS-PTR6. 094700 094800 MOVE 256 TO LINE-LENGTH. 094900 MOVE SPACES TO DISPLAY-LINE. 095000 095100 IF XSS-DISPLAY (XS-PTR6) NOT = SPACES 095200 PERFORM DISPLAY-ITEMSA. 095300 095400 DISPLAY-ITEMSA. 095500 MOVE SPACES TO ITEM-NAMEN. 095600 095700* 1 ITEM-REF. 095800* 5 FILLER PIC X(9) VALUE '". 096300* 5 ITEMREF2 PIC X(30) VALUE SPACES. 096400* 5 ITEMTYPE PIC X(8) VALUE SPACES. 096500* 5 ITEMCHAR PIC X(80) VALUE SPACES. 096600 096700 MOVE SPACES TO ITEMREF1. 096800 MOVE SPACES TO ITEMREF2. 096900 097000 STRING XSS-ITEM (XS-PTR6) '"' 097100 DELIMITED BY SPACE 097200 INTO ITEMREF1. 097300 097400 STRING XSS-ITEM (XS-PTR6) '' 097500 DELIMITED BY SPACE 097600 INTO ITEMREF2. 097700 097800 MOVE XSS-PROPERTIES (XS-PTR6) TO ITEMTYPE. 097900 098000 MOVE SPACES TO ITEMCHAR. 098100 098200 MOVE ITEM-REF TO DISPLAY-LINE. 098300 098400 PERFORM LISTOUT. 098500 098600* Find the datasets for this item: 098700 CALL "DBINFO" USING BASE, ITEM-NAME (XS-PTR6), MODE204, 098800 STAT, ITEM-DATASETS. 098900 099000 MOVE 1 TO SUB. 099100 099200 MOVE IM (1) TO DSPLY-ITM. 099300 099400 IF IM (1) > 1 099500 DISPLAY 099600 DSPLY-ITM " Datasets with " ITEM-NAME (XS-PTR6) CR LF. 099700 099800 IF IM (1) > 0 099900 DISPLAY ''. 100200 100300 DISPLAY " " CR LF. 100400 100500 DISPLAY-ITEMSB. 100600 ADD 1 TO SUB. 100700 MOVE IM (SUB) TO SUB3. 100800 100900 MOVE SPACES TO GOAL. 101000 MOVE DATA-SET-REF (SUB3) TO SUB8. 101100 101200 CALL "DBINFO" USING BASE, DATA-SET-TABLE (SUB3), MODE302, 101300 STAT, SKO (SUB3). 101400 101500 IF SKI (SUB3) = XS-PTR6 MOVE '(Key)' TO GOAL. 101600 101700 MOVE LOW-VALUES TO PATHS. 101800 101900 CALL "DBINFO" USING BASE, DATA-SET-TABLE (SUB3), MODE301, 102000 STAT, PATHS. 102100 102200 IF GOAL = SPACES 102300 CALL "DBINFO" USING BASE, DATA-SET-TABLE (SUB3), MODE301, 102400 STAT, PATHS 102500 IF PATH-NO > 0 AND < 17 102600 MOVE 0 TO SUB4 102700 PERFORM FIND-GOAL PATH-NO TIMES. 102800 102900 MOVE SPACES TO DSTYPE. 103000 103100 IF DATA-SET-TYPE (SUB8) = "M" OR "m" 103200 MOVE "Master" TO DSTYPE ELSE 103300 IF DATA-SET-TYPE (SUB8) = "D" OR "d" 103400 MOVE "Detail" TO DSTYPE ELSE 103500 IF DATA-SET-TYPE (SUB8) = "a" OR "A" 103600 MOVE "Automatic" TO DSTYPE. 103700 103800 MOVE SPACES TO SIIN. 103900 MOVE SPACES TO SIIN1. 104000 MOVE SPACES TO SIIT. 104100 MOVE SPACES TO SIIK. 104200 104300 STRING DATA-SET-TABLE (SUB3) '"' DELIMITED BY SPACE 104400 INTO SIIN. 104500 104600 STRING DATA-SET-TABLE (SUB3) '' DELIMITED BY SPACE 104700 INTO SIIN1. 104800 104900 MOVE DSTYPE TO SIIT. 105000 105100 MOVE GOAL TO SIIK. 105200 105300 DISPLAY SET-IN-ITEM. 105400 105500 FIND-GOAL. 105600 ADD 1 TO SUB4. 105700 MOVE PATH-SEARCH (SUB4) TO SUB5. 105800 MOVE PATH-SORT (SUB4) TO SUB6. 105900 106000 IF PATH-SEARCH (SUB4) = XS-PTR6 MOVE "(Search)" TO GOAL. 106100 106200 IF PATH-SORT (SUB4) = XS-PTR6 MOVE "(Sort)" TO GOAL. 106300 106400*---------------------------------------------------------- 106500* 106600* Processing of the items within the dataset display 106700* 106800* Called from DISPLAY-DATA-SET-ITEMS. 106900* 107000*---------------------------------------------------------- 107100 DBINFO-CALL104. 107200 CALL "DBINFO" USING BASE, DATA-SET-NAME (SS-PTR6), 107300 MODE104, STAT, DATASET-ITEMS. 107400 107500 MOVE DI (1) TO DSPLY-ITM. 107600 107700* Have any items? 107800 IF DI (1) > 1 107900 DISPLAY DSPLY-ITM " Items in Data Set" CRLF CRLF 108000 MOVE 1 TO SUB 108100 DISPLAY ''. 108400 108500 DBINFO-CALL104A. 108600 ADD 1 TO SUB. 108700 MOVE DI (SUB) TO SUB1. 108800 108900* Have the item in the table? 109000 IF XSS-DISPLAY (SUB1) NOT = SPACES 109100 PERFORM DBINFO-CALL104B 109200 ELSE 109300 MOVE SUB1 TO DSPLY 109400 DISPLAY DSPLY "Item was spaces". 109500 109600 DBINFO-CALL104B. 109700 109800* Set up for crossreference display: 109900 MOVE SPACES TO ITEM-NAMEN. 110000 110100* 1 ITEM-REF. 110200* 5 FILLER PIC X(9) VALUE '". 110700* 5 ITEMREF2 PIC X(30) VALUE SPACES. 110800* 5 ITEMTYPE PIC X(8) VALUE SPACES. 110900* 5 ITEMCHAR PIC X(80) VALUE SPACES. 111000 111100 MOVE SPACES TO ITEMREF1. 111200 MOVE SPACES TO ITEMREF2. 111300 MOVE 'href' TO ITEMNAMEHREF. 111400 MOVE '="#item_' TO ITEMU. 111500 111600 STRING XSS-ITEM (SUB1) '"' 111700 DELIMITED BY SPACE 111800 INTO ITEMREF1. 111900 112000 STRING XSS-ITEM (SUB1) '' 112100 DELIMITED BY SPACE 112200 INTO ITEMREF2. 112300 112400 MOVE XSS-PROPERTIES (SUB1) TO ITEMTYPE. 112500 112600 MOVE SPACES TO ITEMCHAR. 112700 112800 STRING '
  • ', ITEM-REF 112900 DELIMITED BY SIZE 113000 INTO DISPLAY-LINE. 113100 113200 MOVE " " TO PATH-SW9. 113300 113400* If we match the search-key item, we have a match to process: 113500 IF SUB1 = SEARCH-KEY-ITEM 113600 PERFORM DBINFO-CALL104C 113700 ELSE 113800 IF PATH-NO > 0 AND < 17 113900 MOVE 0 TO SUB4 114000 PERFORM CHECK-PATHS UNTIL SUB4 = PATH-NO. 114100 114200 IF NOT PATH-SW PERFORM LISTOUT. 114300 114400 CHECK-PATHS. 114500 ADD 1 TO SUB4. 114600 114700 IF PATH-SEARCH (SUB4) = SUB1 114800 MOVE PATH-KEY (SUB4) TO SUB7 114900 STRING '(Search(' 115100 DATA-SET-TABLE (SUB7) '))' 115200 DELIMITED BY SPACES INTO ITEMCHAR 115300 MOVE PATH-NO TO SUB4 115400 PERFORM STRING-ITEM 115500 ELSE 115600 IF PATH-SORT (SUB4) = SUB1 115700 STRING '(Sort(' 115900 DATA-SET-TABLE (SUB7) '))' 116000 DELIMITED BY SPACES INTO ITEMCHAR 116100 MOVE PATH-NO TO SUB4 116200 PERFORM STRING-ITEM. 116300 116400 STRING-ITEM. 116500 MOVE SPACES TO DISPLAY-LINE. 116600 STRING '
  • ', ITEM-REF 116700 DELIMITED BY SIZE 116800 INTO DISPLAY-LINE. 116900 117000 PERFORM LISTOUT. 117100 117200 SET PATH-SW TO TRUE. 117300 117400 DBINFO-CALL104C. 117500 IF SEARCH-KEY-MASTER = 0 117600 MOVE "(Key)" TO ITEMCHAR 117700 PERFORM STRING-ITEM 117800 ELSE 117900 PERFORM DBINFO-CALL104D. 118000 118100 118200 DBINFO-CALL104D. 118300 MOVE SPACES TO DISPLAY-LINE. 118400 MOVE SPACES TO ITEMCHAR. 118500 118600 STRING "(Search(!" 118700 '' 119100 DATA-SET-TABLE (SEARCH-KEY-MASTER) 119200 '))' 119300 DELIMITED BY SPACE 119400 INTO ITEMCHAR. 119500 119600 STRING '
  • ', ITEM-REF DELIMITED BY SIZE 119700 INTO DISPLAY-LINE 119800 119900 PERFORM LISTOUT. 120000 120100 SET PATH-SW TO TRUE. 120200 120300 DBINFO-CALL813. 120400 CALL "DBINFO" USING BASE, QUALIFIER, MODE813, STAT, 120500 TPIITEMS. 120600 120700 MOVE 0 TO SUB. 120800 120900 IF TPI1 > 0 PERFORM DBINFO-CALL813A TPI1 TIMES. 121000 121100 DISPLAY "
    " CRLF. 121200 121300 DBINFO-CALL813A. 121400 ADD 1 TO SUB. 121500 MOVE TPIO (SUB) TO XUB1. 121600 MOVE TPIO (SUB) TO SUB1. 121700 121800 IF XUB1 > 1024 OR < 1 121900 PERFORM DBINFO-CALL813C. 122000 122100 DBINFO-CALL813C. 122200 DISPLAY TXSS-HEAD. 122300 MOVE SPACES TO TXSSHEAD. 122400 122500 MOVE 0 TO SUB2. 122600 122700 CALL "DBINFO" USING BASE, SUB1, MODE812, STAT, 122800 TXSS-OCCURS. 122900 123000 IF IMAGE-STATUS NOT = 0 PERFORM DBEXPLAIN. 123100 123200 MOVE TITEM-NAME TO TXSS-DISPLAY. 123300 123400 MOVE SPACES TO XSS-TEMP-PROPERTIES. 123500 123600 MOVE SPACES TO SJW. 123700 MOVE TITEM-LENGTH TO SJW-NUM. 123800 123900 PERFORM UNTIL SJW-X2 NOT = "0" 124000 MOVE SJW-R3 TO SJW1 124100 END-PERFORM. 124200 124300 STRING TITEM-TYPE 124400 SJW DELIMITED BY SPACE 124500 INTO XSS-TEMP-PROPERTIES. 124600 124700 IF TITEM-COUNT > 1 124800 PERFORM DBINFO-CALL813B 124900 ELSE 125000 MOVE XSS-TEMP-PROPERTIES TO TXSS-PROPERTIES. 125100 125200 MOVE TITEM-LENGTH TO DSPLY-ITM. 125300 125400 IF TXSS-PROPERTIES NOT = SPACES 125500 DISPLAY '' TXSS-ITEM ' ' TXSS-PROPERTIES 125600 ELSE 125700 DISPLAY '' TXSS-ITEM ''. 125800 125900 IF TITEM-KTYPE = 0 DISPLAY " Not an OMNIDEX Key" ELSE 126000 IF TITEM-KTYPE = 1 DISPLAY " OMNIDEX Key only" ELSE 126100 IF TITEM-KTYPE = 2 DISPLAY " Image and OMNIDEX Key". 126200 126300 DISPLAY CRLF. 126400 126500* Find the datasets for this item: 126600 CALL "DBINFO" USING BASE, TITEM-NAME, MODE821, 126700 STAT, ITEM-DATASETS. 126800 126900 MOVE IM (1) TO SUB3. 127000 MOVE 1 TO SUB4. 127100 PERFORM DBINFO-CALL821 SUB3 TIMES. 127200 127300 DBINFO-CALL821. 127400 ADD 1 TO SUB4. 127500 MOVE IM (SUB4) TO SUB5. 127600 STRING '
  • ' 127800 DATA-SET-TABLE (SUB5) '' DELIMITED BY SPACE 127900 INTO DISPLAY-LINE. 128000 PERFORM LISTOUT. 128100 128200 DBINFO-CALL813B. 128300 MOVE SPACES TO SJW. 128400 MOVE TITEM-COUNT TO SJW-NUM. 128500 128600 PERFORM UNTIL SJW-X2 NOT = "0" 128700 MOVE SJW-R3 TO SJW1 128800 END-PERFORM. 128900 129000 STRING XSS-TEMP-PROPERTIES 129100 "(" SJW ")" 129200 DELIMITED BY SPACE 129300 INTO TXSS-PROPERTIES. 129400 129500 DBINFO-CALL103. 129600 CALL "DBINFO" USING BASE, QUALIFIER, MODE103, STAT, 129700 XITEMS. 129800 129900 MOVE 1 TO SUB2. 130000 130100 PERFORM DBINFO-CALL102 I0 (1) TIMES. 130200 130300 IF TPI-ON 130400 PERFORM DBINFO-CALL813. 130500 130600 DISPLAY I0 (1) " Items in Database " BASE-NAME 130700 '
    ' CR LF. 130800 130900 MOVE 1 TO SUB9. 131000 PERFORM DISPLAY-ITEMS I0 (1) TIMES. 131100 131200 131300 DBINFO-CALL102. 131400 ADD 1 TO SUB2. 131500 MOVE I0 (SUB2) TO XS-PTR1. 131600 131700* Get the item name: 131800 CALL "DBINFO" USING BASE, XS-PTR1, MODE102, STAT, 131900 XSS-OCCURS (XS-PTR1). 132000 132100 IF ITEM-NAME (XS-PTR1) NOT = SPACES 132200 PERFORM DBINFO-CALL102A. 132300 132400 DBINFO-CALL102A. 132500 MOVE ITEM-NAME (XS-PTR1) TO XSS-DISPLAY (XS-PTR1). 132600 132700 MOVE SPACES TO XSS-TEMP-PROPERTIES. 132800 132900 MOVE SPACES TO SJW. 133000 MOVE ITEM-LENGTH (XS-PTR1) TO SJW-NUM. 133100 133200 PERFORM UNTIL SJW-X2 NOT = "0" 133300 MOVE SJW-R3 TO SJW1 133400 END-PERFORM. 133500 133600 STRING ITEM-TYPE (XS-PTR1) 133700 SJW DELIMITED BY SPACE 133800 INTO XSS-TEMP-PROPERTIES. 133900 134000 IF ITEM-COUNT (XS-PTR1) > 1 134100 PERFORM DBINFO-CALL102B 134200 ELSE 134300 MOVE XSS-TEMP-PROPERTIES TO XSS-PROPERTIES (XS-PTR1). 134400 134500 DBINFO-CALL102B. 134600 MOVE SPACES TO SJW. 134700 MOVE ITEM-COUNT (XS-PTR1) TO SJW-NUM. 134800 134900 PERFORM UNTIL SJW-X2 NOT = "0" 135000 MOVE SJW-R3 TO SJW1 135100 END-PERFORM. 135200 135300 STRING XSS-TEMP-PROPERTIES 135400 "(" SJW ")" 135500 DELIMITED BY SPACE 135600 INTO XSS-PROPERTIES (XS-PTR1). 135700 135800 SORT-START. 135900 MOVE SS-PTR1 TO SS-PTR3. 136000 MOVE 1 TO SS-PTR2. 136100 136200 PERFORM SORT-X1 UNTIL SS-PTR3 NOT > SS-PTR2. 136300 136400 SORT-X1. 136500 IF SSS-KEY (SS-PTR2) > SSS-KEY (SS-PTR3) 136600 MOVE SSS-OCCURS (SS-PTR3) TO SORT-RECORD 136700 MOVE SSS-OCCURS (SS-PTR2) TO SSS-OCCURS (SS-PTR3) 136800 MOVE SORT-RECORD TO SSS-OCCURS (SS-PTR2). 136900 137000 MOVE SS-PTR2 TO SS-PTR4. 137100 137200 COMPUTE SS-PTR5 = (SS-PTR3 - SS-PTR2) - 1. 137300 137400 IF SS-PTR5 > 0 137500 PERFORM SORT-X2 SS-PTR5 TIMES. 137600 137700 ADD 1 TO SS-PTR2. 137800 SUBTRACT 1 FROM SS-PTR3. 137900 138000 SORT-X2. 138100 ADD 1 TO SS-PTR4. 138200 138300 IF SSS-KEY (SS-PTR4) > SSS-KEY (SS-PTR3) 138400 MOVE SSS-OCCURS (SS-PTR3) TO SORT-RECORD 138500 MOVE SSS-OCCURS (SS-PTR4) TO SSS-OCCURS (SS-PTR3) 138600 MOVE SORT-RECORD TO SSS-OCCURS (SS-PTR4) 138700 ELSE 138800 IF SSS-KEY (SS-PTR4) < SSS-KEY (SS-PTR2) 138900 MOVE SSS-OCCURS (SS-PTR2) TO SORT-RECORD 139000 MOVE SSS-OCCURS (SS-PTR4) TO SSS-OCCURS (SS-PTR2) 139100 MOVE SORT-RECORD TO SSS-OCCURS (SS-PTR4). 139200* --------------------------------------------------- 139300 139400 LIST-OUT1. 139500 IF DSPLY-LN (LINE-LENGTH) = " " 139600 SUBTRACT 1 FROM LINE-LENGTH. 139700 139800 LISTOUT. 139900 MOVE 256 TO LINE-LENGTH. 140000 140100 PERFORM LIST-OUT1 UNTIL LINE-LENGTH < 2 OR 140200 DSPLY-LN (LINE-LENGTH) NOT = " ". 140300 140400 COMPUTE NEG-LENGTH = LINE-LENGTH * (-1). 140500 140600 DISPLAY DISPLAY-LINE CR LF. 140700 140800 MOVE 256 TO LINE-LENGTH. 140900 MOVE SPACES TO DISPLAY-LINE. 141000 141100 JUSTIFY-INFO. 141200 IF INFO NOT = SPACES 141300 PERFORM JUSTIFY-INFO1 UNTIL INFO-X NOT = " ". 141400 141500 INSPECT INFO CONVERTING LOWER TO UPPER. 141600 141700 JUSTIFY-INFO1. 141800 MOVE INFO-R TO INFO. 141900 142000 NR-PROCESSING. 142100 MOVE SPACES TO NRNAME. 142200 STRING NR-NAME, "" DELIMITED BY SPACES INTO NRNAME. 142300 142400 MOVE SPACES TO NRN. 142500 MOVE SPACES TO NRH. 142600 142700 STRING NR-PREFIX1, NR-NAME, '"' DELIMITED BY SPACES 142800 INTO NRN. 142900 143000 STRING '#' NR-PREFIX2, NR-NAME, '"' DELIMITED BY SPACES 143100 INTO NRH. 143200 143300 POSIX-SECTION SECTION. 143400 143500* HANDLE-GET: Handle an http Method GET request from client 143600 143700* First retrieve the QUERY_STRING Posix env var and echo it back 143800* to the client. Then check the value and adjust to proper range 143900* IF appropriate. Finally PERFORM loop to send test lines back to 144000* the client (hey, this is not meant to be a fancy web page...) 144100 144200 handle-get. 144300 STRING "QUERY_STRING" NUL 144400 DELIMITED BY SIZE INTO env-name. 144500 144600 PERFORM my-getenv. 144700 144800 IF env-length = 0 then 144900 145000 DISPLAY "

    GET Method needs valid QUERY_STRING

    " CR LF 145100 145200 145300 ELSE 145400 145500 DISPLAY "

    GET Method received QUERY_STRING as " 145600 env-text (1:env-length) "

    " CR LF 145700 145800 COMPUTE loop-count = function numval (env-text) 145900 146000 IF loop-count < 1 then 146100 MOVE 1 to loop-count 146200 DISPLAY "

    Loop Count was less than one

    " CR LF 146300 end-if 146400 146500 IF loop-count > 1000 then 146600 MOVE 1000 to loop-count 146700 DISPLAY "

    Loop Count was greater than 1000

    " CR LF 146800 end-if 146900 147000* Now return the (loop-count) lines to the web client 147100 147200 DISPLAY "
    " CR LF
    147300
    147400       PERFORM WITH test before until loop-count < 1
    147500        DISPLAY "Test message loop countdown at " loop-count CR LF
    147600         SUBTRACT 1 from loop-count
    147700       end-perform
    147800
    147900       DISPLAY "
    " CR LF 148000 148100 end-if. 148200 148300 148400* HANDLE-POST: Handle an http Method POST request from client 148500 148600* First retrieve the CONTENT_LENGTH Posix env var and echo it back 148700* to the client. Then read that number of bytes from stdin, unless 148800* it is more than our buffer can hold, and echo it back to the web 148900* page. Parse the input STRING for fields named MYTEXT and MYLOOP, 149000* supplying default values in case they are missing. Finally send 149100* output lines WITH MYTEXT according to the MYLOOP count. 149200 149300* Notice that the output loop does not CALL the PRINT intrinsic 149400* for every line but tries to combine as many lines as possible 149500* in the (relatively large) output buffer. This might improve the 149600* performance and reduce the resource consumption. The loops in 149700* handle-post and handle-get have been implemented differently to 149800* allow comparing them easily (try 1000 loops, for example). 149900 150000 150100 handle-post. 150200 STRING "CONTENT_LENGTH" NUL 150300 DELIMITED BY SIZE INTO env-name. 150400 150500 PERFORM my-getenv. 150600 150700 DISPLAY "

    POST Method received CONTENT_LENGTH as " 150800 env-text (1 : env-length) "

    " CR LF 150900 151000 COMPUTE post-length = function numval (env-text) 151100 151200 IF post-length > function length (post-buf) then 151300 151400 DISPLAY "

    Too much DATA for my POST buffer

    " CR LF 151500 151600 ELSE 151700 151800 COMPUTE post-get = - post-length 151900 152000 CALL intrinsic "readx" 152100 USING post-buf , post-get GIVING post-got 152200 152300 DISPLAY "

    Received " post-got " bytes WITH " 152400 post-buf (1 : post-got) "

    " CR LF 152500 152600* Use defaults IF MYLOOP and/or MYTEXT missing in HTML Form 152700 152800 MOVE 10 to loop-count 152900 MOVE "Default Test Message" to test-msg 153000 MOVE 20 to test-msg-len 153100 153200* Terminate the buffer STRING for easier parsing loop 153300 153400 MOVE "&" to post-buf (post-got + 1 : 1) 153500 153600* Begin parsing to extract MYLOOP and MYTEXT fields 153700 153800 MOVE 1 to post-pos 153900 154000 PERFORM WITH test before until post-length <= 0 154100 154200 INITIALIZE field-name 154300 INITIALIZE field-value 154400 154500 UNSTRING post-buf delimited by "=" 154600 INTO field-name count in field-name-len 154700 WITH pointer post-pos 154800 154900 UNSTRING post-buf delimited by "&" 155000 INTO field-value count in field-value-len 155100 WITH pointer post-pos 155200 155300 EVALUATE field-name 155400 WHEN "mytext" MOVE field-value to test-msg 155500 MOVE field-value-len to test-msg-len 155600 WHEN "myloop" COMPUTE loop-count 155700 = function numval (field-value) 155800 end-evaluate 155900 156000 SUBTRACT field-name-len from post-length 156100 SUBTRACT field-value-len from post-length 156200 SUBTRACT 2 from post-length 156300 156400 end-perform 156500 156600* Now return the (loop-count) lines to the web client, 156700* but utilize our buffer to use fewer calls to PRINT 156800 156900 DISPLAY "
    " CR LF
    157000
    157100       PERFORM WITH test before until loop-count <= 0
    157200
    157300         DISPLAY "Countdown at " loop-count
    157400           " WITH message " test-msg (1 : test-msg-len) CR LF
    157500
    157600
    157700         SUBTRACT 1 from loop-count
    157800
    157900       end-perform
    158000
    158100       DISPLAY "
    " CR LF 158200 158300 end-if. 158400 158500 158600* HANDLE-ERR: Return error to client for unknown REQUEST-METHOD 158700 158800 handle-err. 158900 DISPLAY "

    Unknown REQUEST_METHOD " 159000 env-text (1 : env-length) " received

    " CR LF. 159100 159200* MY-GETENV: retrieve Posix env var USING Posix C lib functions 159300 159400* getenv() returns pointer to C STRING, strlen() determines 159500* STRING length and strncpy() copies appropriate number of 159600* characters to a buffer var in our WORKING-STORAGE SECTION. 159700 159800* notice that this version silently clips "too long" input 159900* and returns a zero-length STRING for undefined env vars. 160000 160100 my-getenv. 160200 INITIALIZE env-text. 160300 160400 CALL "getenv" 160500 USING env-name GIVING env-pointer. 160600 160700 IF env-pointer > 0 then 160800 CALL "strlen" 160900 USING \env-pointer\ GIVING env-length 161000 161100 IF env-length > function length(env-text) then 161200 COMPUTE env-length = function length(env-text) 161300 end-if 161400 161500 CALL "strncpy" 161600 USING env-text , \env-pointer\ , \env-length\ 161700 ELSE 161800 MOVE 0 to env-length 161900 162000 end-if. 162100