使用 ICETOOL 的 DISPLAY 格式化特征线

Formatting breaklines using ICETOOL's DISPLAY

我正在使用 DFSORT 的 ICETOOL DISPLAY 运算符生成帐户列表。我在分支机构上使用 'BREAK' 按排序代码分隔帐户,然后对帐户余额求和。一切正常,但在使用 BTOTAL 对余额求和后,我得到了一个额外的条目(帐户)。我在下面添加了我的代码和结果,以便您更好地理解我的问题。

代码

//SUR0007 JOB (5678),'ACCOUNTS'                          
//RUNIT EXEC PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                    
//DFSMSG DD SYSOUT=*                                     
//TOOLIN DD *                                            
         DISPLAY FROM(INPUT2) LIST(REPORT) -                      
         TITLE('LIST OF BANK ACCOUNTS BY BRANCH')  -          
         HEADER('ACCOUNT') ON(2,8,BI,E'99999999') -               
         HEADER('BALANCE') ON(3,6,BI,E'99999999') -               
         HEADER('OWNER') ON(13,30,CH) -                           
         BTITLE('SORTCODE:') BREAK(1,4,BI,E'999999') -            
         BTOTAL('BRANCH TOTAL:') -                                
         TOTAL('GRAND TOTAL:')                                    
/*                                                       
//INPUT2 DD DSN=USER.CICS.Z022.BANK.ACCOUNTS,DISP=SHR
//REPORT DD SYSOUT=*  

结果

  SORTCODE:000012

  ACCOUNT    BALANCE  
 --------   --------  
 91317760   97999587  

 BRANCH TOTAL :        
 91317760   97999587  

预期结果

 SORTCODE:000012

 ACCOUNT    BALANCE  
 --------   --------  
 91317760   97999587  

 BRANCH TOTAL : 97999587   

DFSORT 的 ICETOOL DISPLAY 运算符有很多选项,这意味着它有大量的文档。

您应该参考 DFSORT 入门 入门级使用手册,以及 DFSORT 应用程序编程指南 更高级使用.

在 BCOUNT 中,所有 numeric 字段都将显示总计。您的帐户是数字(二进制​​),但如果您不能将其设为非数字,则可以使用 NOST(您可以假装这意味着没有小计)作为您不使用的任何字段格式的一部分想自动求和。

要使 BTOTAL 文本与总计显示在同一行,请在报告说明中使用 STATLEFT

这是应用程序编程指南中两者的使用示例:

 DISPLAY FROM(ACCTS) LIST(FANCY) -
        TITLE('Accounts Report for First Quarter') -
        DATE(MD4/) BLANK -
        HEADER('Amount') ON(12,6,ZD,C1,N08) -
        HEADER(Id') ON(NUM,N02) -
        HEADER('Acct#') ON(31,3,PD,NOST,LZ) -
        HEADER('Date') ON(1,4,ZD,E'99/99',NOST) -
        INDENT(2) BETWEEN(5) -
        STATLEFT -
        TOTAL('Total for Q1') -
        AVERAGE('Average for Q1')

同一报告的普通版本有编码:

DISPLAY FROM(ACCTS) LIST(PLAIN) -
    TITLE('Accounts Report for First Quarter') -
    DATE(MD4/) BLANK -
    HEADER('Amount') ON(12,6,ZD) -
    HEADER(Id') ON(NUM) -
    HEADER('Acct#') ON(31,3,PD) -
    HEADER('Date') ON(1,4,ZD) -
    TOTAL('Total for Q1') -
    AVERAGE('Average for Q1')

带有示例解释的输出是:

This example shows some options you can use to improve the appearance of a DISPLAY report. The first DISPLAY operator produces a "plain" report, and the second DISPLAY operator uses the options shown in bold to produce a "fancy" report.

The PLAIN output starts on a new page and looks as follows:

Accounts Report for First Quarter               05/04/2001

         Amount                 Id                  Acct#                    Date
---------------    ---------------    -------------------    --------------------
          93271                  1                  15932                     106
         137622                  2                    187                     128
          83147                  3                  15932                     212
         183261                  4                   2158                     217
          76389                  5                    187                     305
         920013                  6                  15932                     319

Total for Q1
        1493703                                     50328                    1287

Average for Q1
         248950                                      8388                     214



The FANCY output starts on a new page and looks as follows:

Accounts Report for First Quarter             05/04/2001

                       Amount         Id        Acct#      Date
                     --------        ---       ------     -----
                       932.71          1        15932     01/06
                     1,376.22          2        00187     01/28
                       831.47          3        15932     02/12
                     1,832.61          4        02158     02/17
                       763.89          5        00187     03/05
                     9,200.13          6        15932     03/19

Total for Q1        14,937.03

Average for Q1       2,489.50

Here is an explanation of the extra options used for the "fancy" report:

First ON field: In the PLAIN report, BLANK causes ICETOOL to print 

the 6-byte ZD values as unedited digits with leading zeros suppressed. But for this example, we know the digits really represent dollars and cents. So in the FANCY report, we use the C1 formatting item (one of thirty-three available masks) to print the values with a comma (,) as the thousands separator and a period (.) as the decimal point.

In the PLAIN report, TOTAL causes ICETOOL to allow 15 digits for the 

values because it does not know how many digits are needed. But for this example, we know the total amount will not exceed 8 digits. So in the FANCY report, we use the N08 formatting item to set the number of digits to 8. This decreases the column width for the field.

Second ON field: In the PLAIN report, NUM causes ICETOOL to allow 15 

digits for the record number because it does not know how many digits are needed. But for this example, we know the number of records will not exceed 99. So in the FANCY report, we use the N02 formatting item to set the number of digits to 2. This decreases the column width for the record number.

Third ON field: In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to 

print the total and average for this 3-byte PD field. But for this example, we know we do not want statistics for the field because it is an account number. So in the FANCY report, we use the NOST formatting item to suppress the statistics for this field.

In the PLAIN report, the default mask of A0 causes ICETOOL to suppress 

leading zeros for this 3-byte PD field. But for this example, we know that we want to show leading zeros for the field because it is an account number. So in the FANCY report, we use the LZ formatting item to print leading zeros for this field.

Fourth ON field: In the PLAIN report, BLANK causes ICETOOL to print the 

4-byte ZD values as unedited digits with leading zeros suppressed. But for this example, we know the digits represent a date (month and day). So in the FANCY report, we use the E'99/99' formatting item to print the values with leading zeros and a slash (⁄) between the month and day.

In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to print the total 

and average for this 4-byte ZD field. But for this example, we know we do not want the total or average for this field because it is a date. So in the FANCY report, we use the NOST formatting item to suppress the statistics for this field.

Note: In some applications, we might want the minimum and maximum for a 

date displayed with E'pattern', so we would not specify NOST for the date field.

INDENT: In the PLAIN report, ICETOOL starts the report in column 2 

(after the control character), by default. But for this example, we want to indent the report a bit. So in the FANCY report, we use the INDENT(2) operand to indent the report by 2 blanks so it starts in column 4.

BETWEEN: In the PLAIN report, ICETOOL uses 3 blanks between the columns 

of data, by default. But for this example, we want more space between the columns. So in the FANCY report, we use the BETWEEN(5) operand to insert 5 blanks between the columns.

STATLEFT: In the PLAIN report, ICETOOL prints the strings for TOTAL

and AVERAGE under the first column of data, by default, and uses two lines for each statistic to avoid having the string overlay the value. But for this example, we would like to have the TOTAL and AVERAGE strings stand out in the report and also have each string on the same line as its value. So in the FANCY report, we use the STATLEFT operand to print the TOTAL and AVERAGE strings to the left of the first column of data.

这里是 link,其中还包括一个 "plain" 版本的报告,与花哨的报告形成对比:http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_Example_1110.htm

我通过 icetool display statleft nost 的搜索引擎找到了 link。