Top
NetCOBOL V11.0 Getting Started
FUJITSU Software

A.10 Sample 9: Using a Print File (Advanced usage)

Sample 9 demonstrates:

Refer to “Printing” in the “NetCOBOL User's Guide” for details on using “print file 1” and “print file 2”.

Overview

Following table below describes each of the tasks performed by this sample. The tasks show a number of printing features. There are essentially four elements that give you control over the various printing features:

  1. COBOL syntax

    • PRINTING MODE clauses in the SPECIAL-NAMES paragraph.

    • ASSIGN TO PRINTER in the SELECT statement.

    • CHARACTER TYPE and PRINTING POSITION clauses in data definitions.

  2. The I-Control Record

    A record that you write to the print file using the syntax:

    “CTL IS page-cntl” in SPECIAL-NAMES

    and

    WRITE I-Control-Record AFTER ADVANCING page-cntl

  3. Forms Control Buffers (FCBs)

    These are form information buffers stored by the COBOL run-time system, using information defined in environment variables of the form “FCBxxxx=”.

  4. Environment variables

    Environment variables define fonts, FCBs, document names and other printing details.

Following table indicates which of the above are used to provide a particular feature. You will need to read the table, inspect the COBOL code, and consult the chapter on “Printing” in the “NetCOBOL User's Guide” to fully understand all the features being demonstrated.

Task Description

Detailed features

Controlled by I-Control field / COBOL clause

Related Environment

Variable(s)

1a. Prints a page at 6 LPI, 10 CPI on a PowerFORM overlay grid

6 LPI - defined in FCB

I-Control:

FCB-NAME (=”LT6L”)

FCBLT6L=…

10 CPI

PRINTING MODE x …

AT PITCH …

+

CHARACTER TYPE x

Letter size paper

I-Control:

PAPER-SIZE (=”LTR”)

Impact font

PRINTING MODE x

… WITH FONT GOTHIC

+

CHARACTER TYPE x

@PrinterFontName=

(…, Impact)

Courier New font

PRINTING MODE x

… WITH FONT

MINCHOU …

+

CHARACTER TYPE x

@PrinterFontName=

(Courier New, …)

Grid (PowerFORM

overlay -

KOL6LT6L.OVD)

I-Control:

FOVL-NAME (=”LT6L”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Data item position

within line

PRINTING POSITION

Different character type

forms

PRINTING MODE x

… FORM …

+

CHARACTER TYPE x

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC1)

@CBR_DocumentName_DOC1=<document

name string>

1b. Prints a page at 8 LPI, 10 CPI on a PowerFORM overlay grid

8 LPI - defined in FCB

I-Control:

FCB-NAME (=”LT8L”)

FCBLT8L=…

10 CPI

PRINTING MODE x …

AT PITCH …

+

CHARACTER TYPE x

Letter size paper

I-Control:

PAPER-SIZE (=”LTR”)

Impact font

PRINTING MODE x

… WITH FONT GOTHIC

+

CHARACTER TYPE x

@PrinterFontName=

(…, Impact)

Courier New font

PRINTING MODE x

… WITH FONT

MINCHOU …

+

CHARACTER TYPE x

@PrinterFontName=

(Courier New, …)

Grid (PowerFORM

overlay -

KOL6LT8L.OVD)

I-Control:

FOVL-NAME (=”LT8L”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Data item position

within line

PRINTING POSITION

Different character type

forms

PRINTING MODE x

… FORM …

+

CHARACTER TYPE x

2a. Prints letters in font sizes: 3, 7.2, 9, 12, 18, 24, 36, 50, 72, 100, 200, and 300 points.

On legal-sized paper (After printing a header page)


COBOL run time system automatically calculates the best character pitch fitted to the character size (character pitch specification is omitted).

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC1)

@CBR_DocumentName_DOC1=<document

name string>

Different font sizes

PRINTING MODE x

… IN SIZE nn POINT …

+

CHARACTER TYPE x

Legal size paper

I-Control:

PAPER-SIZE (=”XXX”)

FCB-NAME (=”LPI6”)

@PRN_FormName_XXX=Legal 8 1/2 x 14 in

FCBLPI6=…

Impact font

Default - Gothic font

@PrinterFontName=

(…, Impact)

Shaded background

(PowerFORM overlay -

KOL6LGLT.OVD)

I-Control:

FOVL-NAME (=”LGLT”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC2)

@CBR_DocumentName_DOC2=<document

name string>

2b. Prints characters at pitches: 1, 2, 3, 5, 6, 7.5, 20, and 24 CPI.


Here, the COBOL run

time system automatically calculates the best character size fitted to the character pitch (the character size specification is omitted).

Different pitches

PRINTING MODE x

… AT PITCH n CPI …

+

CHARACTER TYPE x

Legal size paper

I-Control:

PAPER-SIZE (=”XXX”)

FCB-NAME (=”LPI6”)

@PRN_FormName_XXX=Legal 8 1/2 x 14 in

FCBLPI6=…

Impact font

Default - Gothic font

@PrinterFontName=

(…, Impact)

Shaded background

(PowerFORM overlay -

KOL6LGLT.OVD)

I-Control:

FOVL-NAME (=”LGLT”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC2)

@CBR_DocumentName_DOC2=<document

name string>

2c. Prints characters in: Impact,

Impact half-size,

Courier New, Courier

New half size.

Impact font

PRINTING MODE x

… WITH FONT {GOTHIC}

{GOTHIC-HANKAKU} …

+

CHARACTER TYPE x

@PrinterFontName=

(…, Impact)

Courier New font

PRINTING MODE x

… WITH FONT

{MINCHOU}

{MINCHOU-HANKAKU}

+

CHARACTER TYPE x

@PrinterFontName=

(Courier New, …)

Full size

PRINTING MODE x

… BY FORM F …

+

CHARACTER TYPE x

Half size

PRINTING MODE x

… BY FORM H …

+

CHARACTER TYPE x

Legal size paper

I-Control:

PAPER-SIZE (=”XXX”)

FCB-NAME (=”LPI6”)

@PRN_FormName_XXX=Legal 8 1/2 x 14 in

FCBLPI6=…

Shaded background

(PowerFORM overlay -

KOL6LGLT.OVD)

I-Control:

FOVL-NAME (=”LGLT”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC2)

@CBR_DocumentName_DOC2=<document

name string>

2d. Prints

characters in different form sizes:

Em-size,

en-size,

expanded emsize,

expanded ensize,

tall em-size,

tall en-size,

double em-size

and

double en-size.

Em-size

PRINTING MODE x

… BY FORM F …

+

CHARACTER TYPE x

En-size

As above with:

… BY FORM H …

Expanded em-size

As above with:

… BY FORM F0201 …

Expanded en-size

As above with:

… BY FORM H0201 …

Tall em-size

As above with:

… BY FORM F0102 …

Tall en-size

As above with:

… BY FORM H0102 …

Double em-size

As above with:

… BY FORM F0202…

Double en-size

As above with:

… BY FORM H0202…

Legal size paper

I-Control:

PAPER-SIZE (=”XXX”)

FCB-NAME (=”LPI6”)

@PRN_FormName_XXX=Legal 8 1/2 x 14 in

FCBLPI6=…

Shaded background

(PowerFORM overlay -

KOL6LGLT.OVD)

I-Control:

FOVL-NAME (=”LGLT”)

FOVL-R (= 1 - to use

overlay on a single

page)

FOVLTYPE=KOL6

OVD_SUFFIX=OVD

Document name

displayed by Windows

I-Control:

DOCUMENT-NAME

(=DOC2)

@CBR_DocumentName_DOC2=<document

name string>

2e. Prints a mixture of the above features: font size, pitch,

half/full size characters.

Files Included in Sample 9

COBOL Statements Used

The ADD, CLOSE, DISPLAY, IF, MOVE, OPEN, PERFORM, STOP, and WRITE statements are used.

Building/Rebuilding the Program

Project manager's build function is used to create the executable program.

In the following screen snapshots, the sample program was installed to C:\NetCOBOL. Your installation folder may be different.

  1. The project manager is started, and project file "SAMPLE09.PRJ" is opened.

  2. Select "Build" from Project Manager's "Project" menu or click on the Build button in the Project Manager toolbar.

    After the build terminates, check that SAMPLE09.EXE is created.

Checking Execution Environment Information

Sample 9 uses a number of run-time environment variables that play an important part in achieving the demonstrated features.

To check these variables:

  1. From the COBOL Project Manager Tools menu, select “Run-time Environment Setup Tool”.

    The Run-time Environment Setup Tool Window opens.

  2. From the File menu select Open, and select COBOL85.CBR in the sample09 folder. The window should look like below figure.

  3. Check the setting of environment variable FOVLDIR in the list of environment variables. If it is not set to your location for the sample09 folder, change it to that value by:

    a) Selecting FOVLDIR in the environment variable list. “FOVLDIR” will be displayed in the Variable Name field, and its current setting in the Variable Value field.

    b) Use the browse (“…”) button to navigate to the sample09 folder, select any file, and click OK. The path and filename are returned to the Variable Value field.

    c) Delete the last “\” and the file name that follows it from the string in the Variable Value field.

    d) Click the Set button, to set your change in the Section list of environment variables.

    e) Click the Apply button, to save your changes to the COBOL85.CBR file.

  4. When you have finished reviewing the environment variables, select Exit from the File menu.

Debugging the Program

To run this program under the control of the Debugger, select Debug from the Project menu. The Debugger starts and displays the “Start Debugging” dialog box.

Press the ENTER key here and you will be taken into the Debugger.

Executing the Program

To execute in COBOL Project Manager, select Execute from the Project menu. There are no command line arguments.

Execution Results

The sample pages described in table A.3 above are printed to the default printer.