Skip to main content

How to remove character added with CODE in the RD description

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

These two(2) characters appear because specified a 'CODE' clause in the RD (Report Descriptor).  allowing multiple reports to be included within a single report file

The two(2) report 'code' characters are included in the final report output, at the beginning of each line

Is there a way to have Report Writer NOT include

the report CODE at the beginning of each report line?

Resolution:

When the CODE clause is specified, literal-1 is automatically placed in the first two character positions of each report writer logical record.

Following example of using code clause and  how to remove the two characters-

select my-file assign to "a.pnt".

file section.

fd my-file report report-1 report-2.

report section.

rd report-1 code "R1".

1 my-detail type detail

column 1 line plus 1 pic x(10) source "abcd".

rd report-2 code "R2".

1 my-detail-2 type detail

column 1 line plus 1 pic x(10) source "efgh".

procedure division.

open output my-file

initiate report-1 report-2

generate my-detail

generate my-detail

generate my-detail

generate my-detail

terminate report-1

generate my-detail-2

generate my-detail-2

generate my-detail-2

generate my-detail-2

terminate report-2

close my-file

cob demo.cbl

cobrun demo.int

cut -c"3-" a.pnt > b.pnt

Old KB# 2220

0 replies

Be the first to reply!