Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I put fonts in my PC COBOL reports

COBOL Weblers

How can I put fonts in my PC COBOL reports

by  CliveC  Posted    (Edited  )
Basically just inject HTML tags into the output stream and use .HTM as a file extension.

In this example a name is accepted from the command line and a certificate is output to a file named certify.htm.

IDENTIFICATION DIVISION.
PROGRAM-ID. CERTIFY.
AUTHOR. CLIVE CUMMINS.
INSTALLATION. http://tubularity.com
DATE-WRITTEN. DEC 7,2003.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
SELECT OUTPUT-FILE ASSIGN TO OUTPUT-FILE-ID
FILE STATUS IS OUTPUT-RETURN-CODE
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.
FILE SECTION.
FD OUTPUT-FILE.
01 OUTPUT-RECORD PIC X(72).
WORKING-STORAGE SECTION.
01 OUTPUT-PARAMETERS.
02 OUTPUT-RETURN-CODE PIC X(02).
02 OUTPUT-FILE-ID PIC X(12).
01 CERT-TBL.
02 FILLER PIC X(36) VALUE "<html><head><title>COBOL Webler Cert".
02 FILLER PIC X(36) VALUE "ification</title> ".
02 FILLER PIC X(36) VALUE "<style type='text/css'> ".
02 FILLER PIC X(36) VALUE " ".
02 FILLER PIC X(36) VALUE "h2 {font-family: 'Monotype Corsiva',".
02 FILLER PIC X(36) VALUE "'Brush Script MT','cursive'} ".
02 FILLER PIC X(36) VALUE "</style></head><body><div align='cen".
02 FILLER PIC X(36) VALUE "ter'><br /><br /> ".
02 FILLER PIC X(36) VALUE "<h1>This is to Certify that</h1><u><".
02 FILLER PIC X(36) VALUE "h2> ".
02 C-NAME PIC X(72) VALUE "Your Name ".
02 FILLER PIC X(36) VALUE "</h2></u><h3>has acheived the status".
02 FILLER PIC X(36) VALUE " of Master COBOL Webler</h3> ".
02 FILLER PIC X(36) VALUE "</div></body></html> ".
02 FILLER PIC X(36) VALUE " ".
01 FILLER REDEFINES CERT-TBL.
02 CERT-TBL-ENTRY PIC X(72) OCCURS 008 INDEXED BY CERT-TBL-IDX.

PROCEDURE DIVISION.
ACCEPT C-NAME FROM COMMAND-LINE.
MOVE "certify.htm" TO OUTPUT-FILE-ID.
OPEN OUTPUT OUTPUT-FILE.
PERFORM
VARYING CERT-TBL-IDX FROM 1 BY 1
UNTIL CERT-TBL-IDX GREATER THAN 8
MOVE CERT-TBL-ENTRY (CERT-TBL-IDX) TO OUTPUT-RECORD
WRITE OUTPUT-RECORD
END-PERFORM.
CLOSE OUTPUT-FILE.
GOBACK.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top