Advantage CA-Ideal for CA-Datacom Batch Web Interface

Document ID : KB000056072
Last Modified Date : 14/02/2018
Show Technical Document Details

When developing Advantage CA-Ideal for CA-Datacom code for web use, don't forget that batch still has a place in your systems. Some situations call for a "frozen moment in time" to be captured as a document that can be viewed later; for example, a report of inventory in stock at the close of trading each day. These reports can be created quite easily - directly as HTML or XML and loaded into a web server as a static page. This avoids incurring the overhead of regenerating the document each time it is viewed and the need to store the snapshot data needed to produce it.

These programs usually already exist and produce a printed report that is distributed. By replacing the report in the resources of the program and recompiling, you can have a new web-based application for minimal effort.

For example, the program below is an instance of producing a report:

->PROGRAM HTMRPT   VERSION 001  SYSTEM WWW                              
 STATUS TEST IDEAL 022                                                  
 DATE-CREATED  030515                      CREATED-BY  SMIJO01          
 DATE-MODIFIED 030515   TIME-MODIFIED 1322 MODIFIED-BY SMIJO01          
 DATE-COMPILED 030515   TIME-COMPILED 1334                              
 RUN-STATUS PRIVATE                                                     
 LANGUAGE IDEAL                                                         
 SHORT-DESC 'Produces a report'                                         
USES-DATAVIEW EMPLOYEE                         VERSION 0001             
USES-REPORT   HTMRPT   VERSION 001                                      
->PROCEDURE-DATA                                                        
FOR FIRST 20 EMPLOYEE                                                   
   PRODUCE HTMRPT                                                       
ENDFOR                                                                  
->END-PROGRAM                                                           

Replace the original printed report with one using HTML markup - typically using <TABLE> around the columnar data - and just recompile the program.

->REPORT HTMRPT   VERSION 001  SYSTEM WWW                               
 STATUS TEST IDEAL 022                                                  
 DATE-CREATED  030515                      CREATED-BY  SMIJO01          
 DATE-MODIFIED 030515   TIME-MODIFIED 1334 MODIFIED-BY SMIJO01          
 SHORT-DESC 'Report as HTML          '                                  
TEXT1 'Uses <TABLE> tags                                              '
 LINES 000 WIDTH 132 SPACING 1 GAP 00 AFTER-HEAD 1                      
 SUMMARIES-ONLY N COLHEAD N COLHEAD-IND N CONTHEAD N CONTFOOT Y         
 AUTO-SUMMARIES N                                                       
 GROUP-CONTINUATION N ANNOTATED-COUNT N                                 
 FINAL-SUMMARY N SUMMARY-SPACE 1                                        
 DATEPOS NO DATEFOR 'MM/DD/YY       '                                   
 PAGEPOS NO PAGEFMT H PAGEWORD 'PAGE      '                             
 HEADPOS C                                                              
->HEADING-DATA                                                          
 <<RH>>                                                                 
 '<html>'                                                               
                                                       L01              
 '<head><title>Sample report as HTML</title>'                           
 '</head>'                                                              
                                                       L01              
 '<body>'                                                               
                                                       L01              
 '<h1>Employee Report</h1>'                                             
                                                       L01              
 '<table border="1">'                                                   
 <<RF>>                                                                 
 '</table>'                                                             
                                                       L01              
 '</body></html>'                                                       
->DETAIL-DATA                                                           
 '<TR><TD>'                                                             
 EMPLOYEE.NAME                                                          
 '</TD><TD>'                                                            
 EMPLOYEE.CITY-ADDRESS                                                  
 '</TD></TR>=>'                                                           
->END-REPORT                                                            

The result is a web-ready document that looks like this:

<html>                                                             
<head><title>Sample report as HTML</title></head>                  
<body>                                                             
<h1>Employee Report</h1>                                           
<table border="1">                                                 
<TR><TD>PARKER WILLIAM          </TD><TD>CHICAGO        </TD></TR> 
<TR><TD>SNOW TERRI              </TD><TD>HOUSTON        </TD></TR> 
<TR><TD>TURNER ARNOLD           </TD><TD>BOSTON         </TD></TR> 
<TR><TD>LUTHER GARY             </TD><TD>DALLAS         </TD></TR> 
<TR><TD>BRATTON GEORGE          </TD><TD>ATLANTA        </TD></TR> 
<TR><TD>EDWARDS BARRY           </TD><TD>BOSTON         </TD></TR> 
<TR><TD>COURTNEY ELIZABETH      </TD><TD>ATLANTA        </TD></TR> 
<TR><TD>HAGAN LEO               </TD><TD>CHICAGO        </TD></TR> 
<TR><TD>WALKER FRANK            </TD><TD>DALLAS         </TD></TR> 
<TR><TD>DAVENPORT JACQUELINE    </TD><TD>HOUSTON        </TD></TR> 
<TR><TD>PATTERSON AL            </TD><TD>DALLAS         </TD></TR> 
<TR><TD>HAMILTON DAVID          </TD><TD>BOSTON         </TD></TR> 
<TR><TD>HOPKINS BARRY           </TD><TD>CHICAGO        </TD></TR> 
<TR><TD>FARRIOR HOWARD          </TD><TD>CHICAGO        </TD></TR> 
<TR><TD>DRUMMOND GEORGE         </TD><TD>BOSTON         </TD></TR> 
<TR><TD>FULLERTON CARL          </TD><TD>ATLANTA        </TD></TR> 
<TR><TD>LOVELL RAYMOND          </TD><TD>HOUSTON        </TD></TR> 
<TR><TD>EVERS DANNY             </TD><TD>DALLAS         </TD></TR> 
<TR><TD>SCOTT DAVID             </TD><TD>CHICAGO        </TD></TR> 
<TR><TD>NARMOUR ROBERT          </TD><TD>NEW YORK       </TD></TR> 
</table>                                                           
</body></html>                                                     

When shown in a web browser, the result is:

Figure 1

This basic example is probably too simple for a real-life situation, but any amount of presentation improvement can be added during the batch transfer to the web server, such as using XML instead of HTML and processing the report with an XSL style sheet.

Notes on the Report Definition

Certain parameters of a report need to be changed from the defaults to make this work properly.

LINES 000 - selecting zero lines per page suppresses the usual end-of-page processing. The report is a single (web) page, so this is not needed.

SPACING 1 GAP 0 AFTER-HEAD 1
Eliminate white space that HTML ignores.

COLHEAD N COLHEAD-IND N
Eliminate standard column headers.

ANNOTATED-COUNT N FINAL-SUMMARY N SUMMARY-SPACE 1
Eliminate unused end-of-report processing and spacing.

<<RH>>
All the columnar data of this particular report goes in a single table, so everything up to and including the <table> tag are placed in a Report Header. More complex reports would use Break Headers as well.

<<RF>>
The table and all other HTML tags are closed in the Report Footer. Again, Break Footers could also have been used for more complex reports.