This code, developed to run under Windows/98, was designed to speed the process of translating OS/390 and z/OS Assembler Source into HTML displayable format. The white text items represent links to explanation of that part of the code.
/* ---- REXX code to build IBM Assembler Source into an HTML table ---- */ Q1 = "Enter input file name." Q3 = "Enter output file name." Q4 = "Enter HTML Page Title." a1 = console(Q1) a3 = console(Q3)||".html" tg = "<"; /* ---- Initialise I/O variables, and open the files. ---- */ inline = "**" infile = .STREAM~NEW(A1); /* set up file for processing. */ outfile = .STREAM~NEW(A3); /* set up file for processing. */ signal on notready Say ""; Say "Conversion of - " A1 " - to HTML" /* ---- Build all the standard header information etc. ---- */ Call htmlout(tg||"HTML>") a4 = console(Q4) a4 = tg||"TITLE>"||a4||tg||"/TITLE>" Call htmlout(a4) Call htmlout(tg||"STYLE>") Call htmlout("P { font: 10.5pt Arial; line-height:11pt; text-align:justify; }") Call htmlout(tg||"/STYLE>") Call htmlout(tg||"/HEAD>") Call htmlout(tg||"BODY>") Call htmlout(tg||"TABLE WIDTH=620 CELLSPACING=4%>") /* ---- Now convert the main source code. ---- */ Do Forever inline = (infile~LINEIN()) Parse Var inline lab 10 op 16 parms 35 comment 72 cont 73 If Substr(lab,1,1) = "*" Then Call comment Else If Substr(op,1,3) = "DCB" Then Call dcb Else Call convcode End /* ---- Build all the standard ending information etc. ---- */ notready: Call htmlout(tg||"/TABLE>") Call htmlout(tg||"/BODY>") Call htmlout(tg||"/HTML>") Say " "; Say "Conversion of -" A1 "- Successfully completed." Exit 0 /* leave program */ /* ---- The htmlout routine writes the html generated code. ---- */ htmlout: outfile~LINEOUT(arg(1)) Return /* ---- The convcode parses the Assembler to create html generated code. ---- */ convcode: Call htmlout(tg||"TR>") Call htmlout(tg||"TD WIDTH=4%>"||tg||"P>"||Strip(lab,T)||tg||"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=4%>"||tg||"P>"||Strip(op,T)||tg"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=29%>"||tg||"P>"||Strip(parms,T)||tg"/P>"||tg"/TD>") Call htmlout(tg"TD WIDTH=62%>"||tg||"P>"||Strip(comment)||tg||"/P>"||tg||"/TD>") Call htmlout(tg"TD WIDTH=1%>"||tg"P>"||cont||tg||"/P>"||tg"/TD>") Call htmlout(tg||"/TR>") Return /* ---- The comment routine handles extended cell requirement. ---- */ comment: Call htmlout(tg||"TR>"||tg||"TD WIDTH=4%>"||tg||"P>"||lab||tg"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=86% COLSPAN=3>") Call htmlout(tg||"P>"||Substr(inline,10)||tg||"/P>"||tg||"/TD>"||tg||"/TR>") Return /* ---- The dcb routine handles extended operands fields. ---- */ dcb: Call htmlout(tg||"TD WIDTH=4%>"||tg||"P>"||Strip(lab,T)||tg||"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=4%>"||tg||"P>"||Strip(op,T)||tg"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=81% COLSPAN=2>") Call htmlout(tg||"P>"||Substr(inline,16,56)||tg||"/P>"||tg||"/TD>") Call htmlout(tg"TD WIDTH=1%>"||tg"P>"||cont||tg||"/P>"||tg"/TD>"||tg"/TR>") If cont = "*" Then Do inline = (infile~LINEIN()) Parse Var inline lab 10 op 16 parms 35 comment 72 cont 73 Call htmlout(tg||"TR>"tg||"TD WIDTH=4%>"||tg||"P>"||Strip(lab,T)||tg||"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=4%>"||tg||"P>"||Strip(op,T)||tg"/P>"||tg"/TD>") Call htmlout(tg||"TD WIDTH=82% COLSPAN=2>") Call htmlout(tg||"P>"||Substr(inline,16,56)||tg||"/P>"||tg||"/TD>"tg"/TR>") End Return /* ---- The console function asks for input and feeds it back. ---- */ console: Say arg(1) Parse Linein myfile Return myfile
Copyright Ó KMS-IT Limited 2002