The Output Specification Fields (Cont.) [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation
HP RPG/iX Reference Manual
The Output Specification Fields (Cont.)
Field Description Fields (Columns 32-70) (Cont.)
Constant/Edit Word (Columns 45-70).
The constant/edit word field lets you use either a constant or an edit
word when formatting a numeric field for output.
--------------------------------------------------------------------------------------
| | |
| Columns 45-70 | Description |
| | |
--------------------------------------------------------------------------------------
| | |
| From 1 to 24 characters | A constant (if a field name does not appear on this |
| (any letters, digits, or | line) or an edit word (if a field name does appear on |
| special characters) | this line). If there is an edit code in the Edit Code |
| surrounded by quotation | Field (column 38), the Constant/Edit Word Field may |
| marks. | contain a $ (floating dollar sign) or a * (check |
| | protection character). |
| | |
| blank. | No constant is used or no edit word applies. |
| | |
--------------------------------------------------------------------------------------
Constants
A constant is a group of characters that are written exactly as you enter
them. You frequently use constants for report titles, page and column
headings, and record-identifying information. You often use them in
heading records.
To enter a constant:
* Leave the Field Name Field (columns 32-37) blank.
* Begin the constant by entering a quotation mark in column 45.
* Enter the characters in the constant. You can use up to 24 ASCII
characters (the last character can be in any column from 46 to
69). If the constant is longer than 24 characters, enter another
constant line containing the remaining constant characters. You
can continue a constant in this manner using as many of these
lines as necessary.
* End the constant with a quotation mark. The quotation mark can
appear in any column up to 70.
* To include a quotation mark in the constant itself, enter two
quotation marks. For example, to enter the constant, A PROGRAM
NAMED "ALPHA":
"A PROGRAM NAMED ""ALPHA"""
* Enter the last position occupied by the constant in the End
Position Field (columns 40-43).
Example
Figure 9-11 shows several constants. The constant defined in line 1
contains quotation marks. The constant starting in line 2 is continued
to line 3.
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| OPRINTT H 3 01 |
| 1 O 50 "REPORT ON ""PROSPECTS""" |
| O H 3 02 |
| O 9 "LAST NAME" |
| O 20 "FIRST NAME" |
| O 25 "AGE" |
| O 35 "OCCUPATION" |
| 2 O 50 "PERSONNEL EVALUATION BAS" |
| 3 O 72 "ED ON BACKGROUND CHECK" |
| |
| |
___________________________________________________________________________________
Figure 9-11. Entering Constants
Edit Words
Edit words let you insert and replace characters in numeric output
fields. They provide greater flexibility than edit codes see the Edit
Code Field, column 38). You can specify the format of the output field,
character by character. You can insert commas, decimal points, dollar
signs, and other punctuation into the field. For negative fields, you
can insert a minus sign or CR and you can use a floating dollar sign and
an asterisk for check protection.
When you enter an edit word, you enter characters that become the
editing template for the field. Edit words contain replaceable and
non-replaceable characters. Non-replaceable characters are inserted into
the field. If they are to the left of the high-order digit position,
they are replaced by blanks or asterisks (if check protection is used).
If they follow the last replaceable digit position, they are appended to
it. You can use any character as a non-replaceable character except
blank (to use blank, enter an ampersand). Replaceable characters are
place-holders for digits in the field and they are replaced by them.
Replaceable characters include a blank, 0, * and $. Do not include more
than 15 replaceable characters in an edit word.
To enter an edit word:
* Enter the name of the numeric field to be edited in the Field Name
Field (columns 32-37).
* Leave the Edit Code Field (column 38) blank.
* Enter the last position of the edited field in the End Position
Field (columns 40-43).
* Begin the edit word by entering a quotation mark in column 45.
* Enter the characters in the edit word. See Table 9-5 for a
description of the characters that you can include. Enter up to
24 ASCII characters with the last character placed on or before
column 69.
* End the edit word with a quotation mark.
Table 9-5. Edit Word Characters
--------------------------------------------------------------------------------------
| | |
| Edit Word | Description |
| Characters | |
| | |
--------------------------------------------------------------------------------------
| | |
| blank | Replace a blank with a digit from the corresponding position |
| | of the source data field. |
| | |
| 0 | Replace leading zeros with blanks, up to and including this |
| | position. |
| | |
| * | Replace leading zeros with asterisks up to and including this |
| | position (check protection). |
| | |
| $ | If $ is used to the left of a zero, replace leading zeros with |
| | spaces and float the dollar sign to the left of the most |
| | significant digit in the field. |
| | |
| & | Insert a blank into the edited field. |
| | |
| . or , | Insert a decimal point or comma into the edited field. |
| | |
| "" | Insert a quotation mark in the edited text. |
| | |
| +, - or CR | Insert an arithmetic sign into the edited field or insert a CR |
| | into the edited field when the number is negative. |
| | |
| other character | Insert the character into the edited field at this character |
| | location. |
| | |
--------------------------------------------------------------------------------------
0
Normally, leading zeros in a data field are replaced by blanks on output.
You can stop suppression at any point by entering a zero as a replaceable
character in the edit word. The zero is replaced by a character from the
corresponding position of the source data field, unless that character is
also zero (in which case a blank is substituted). Any zeros in the
source data field that appear to the right of the zero suppression
character are printed unaltered. If a non-zero digit appears to the left
of the zero, suppression stops with that non-zero digit.
If you want leading zeros in an edited field, ensure that the edit word
contains at least one more character than the data field, and enter a
zero in the leftmost position of the edit word.
If there are more digit positions in an edit word than there are digits
in the data field, leading zeros are actually added to the data field
before editing takes place, and are then stripped out if required by the
edit word.
*
Use an asterisk to halt zero suppression and to replace the suppressed
zeros with asterisks (check protection). Place the asterisk in the
position where you want zero suppression to stop. If an asterisk
precedes a zero in an edit word, suppression stops with the asterisk and
the zero is printed as a constant.
$
Enter a floating dollar sign to the left of the character position where
you want to stop zero suppression. Zeros to the left of the dollar sign
are suppressed and the dollar sign is placed immediately to the left of
the first non-zero digit. Do not use a floating dollar sign together
with check protection. Allow an additional character position in the
edit word for the floating dollar sign (the number of replaceable
characters must equal or exceed the number of digits in the number).
To print a dollar sign in the leftmost position of the field, enter it in
the leftmost position of the edit word.
&
Use an ampersand to produce a blank in the edited field (the ampersand is
replaced by a blank).
. or ,
Enter a decimal point or comma in an edit word to insert those characters
in the corresponding positions of the edited result. If they precede the
most significant digit in the field, they are replaced by blanks (or
asterisks if you're using check protection).
""
To include a quotation mark in the edited result, enter two adjacent
quotation marks.
+, - or CR
To insert the numeric sign of the field, enter a plus or minus sign to
the right of the low-order digit position in the edit word. If you enter
a negative sign, the sign is printed only when the field is negative.
Likewise, if you enter a positive sign, the sign is printed only when the
field is positive. Enter a credit sign to print CR when the field is
negative. If the field contains all zeros (either positive or negative)
the sign or CR is suppressed to blanks.
Other character
Enter any ASCII character (not listed above) to insert into the field.
Example
Several edit word examples appear in Table 9-6 . The first column
shows the numbers to be edited (the numbers are positive and negative).
The second column shows the edit words and the third column shows the
edited results. _ represents a blank.
Table 9-6. Examples of Edit Words
-----------------------------------------------------------------------------------------------
| | | |
| Input | Edit Word | Edited Result |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| 0042 | "0_HRS.__MINS.&0""CLOCK" | _0HRS.42MIN._0"CLOCK |
| | | |
| 000000 | "_,__0.__" | _____.00 |
| | | |
| 000000 | "_,___.0_" | _______0 |
| | | |
| 000000 | "_,_0_DOLLARS__CENTS&CR" | ____0DOLLARS00CENTS___ |
| | | |
| +000000 | "_,___DOLLARS__CENTS" | ______________CENTS |
| | | |
| +000002 | "__0LBS.&__OZ.TARE&-" | ___0LBS._02OZ.TARE |
| | | |
| -000002 | "___0LBS.__OZ.TARE&-" | ____LBS.02OZ.TARE_- |
| | | |
| 001234 | "0,___,0__" | _,012,034 |
| | | |
| 013579 | "&_,*_0,___" | ***130,579 |
| | | |
| 093066 | "__-__-__&LATER" | _9-30-66_LATER |
| | | |
| 093066 | "__&__&__&LATER" | _9_30_66_LATER |
| | | |
| 100166 | "__/__/__" | 10/01/66 |
| | | |
| 00000000 | "__,___,_0_-&ON&HAND" | _________0__ON_HAND |
| | | |
| -00000000 | "___,__0.__&CR*" | _______.00___* |
| | | |
| 00123456 | "_,__$,0__.__" | ___1$,234.56 |
| | | |
| 000000005 | "_,___,_0_.__-" | ________0.05_ |
| | | |
| -000000015 | "_,___,___.__-" | __________15- |
| | | |
| 095140036 | "0__-__-____" | _95-14-0036 |
| | | |
| 0000000000 | "__,___,_0_*__" | _________0*00 |
| | | |
| 0000000000 | "$__,___,__0.__" | $__________.00 |
| | | |
| 0000000000 | "__,___,___.__CR" | _______________ |
| | | |
| 0000000000 | "__________" | __________ |
| | | |
| +0000000000 | "_,___,___,_0_-OLD&BALANCE" | ____________0_OLD_BALANCE |
| | | |
-----------------------------------------------------------------------------------------------
Table 9-6. Examples of Edit Words (cont.)
-----------------------------------------------------------------------------------------------
| | | |
| Input | Edit Word | Edited Result |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| -0000000000 | "__,___,__*.__-" | **********.00_ |
| | | |
| -0000000000 | "_______*__&CR" | ********00___ |
| | | |
| -0000000000 | "_________*&CR" | **********___ |
| | | |
| -0000000000 | "_________$0" | __________$ |
| | | |
| -0000000000 | "_______$0__&CR&GROSS" | ________$00____GROSS |
| | | |
| -0000000000 | "$_______0__&CR&GROSS" | $________00____GROSS |
| | | |
| -0000000000 | "_________0&-&TOTAL" | _____________TOTAL |
| | | |
| -0000000000 | "__________$-&TOTAL" | _____________TOTAL |
| | | |
| 0000000005 | "___,___,_$9.__" | __________$.05 |
| | | |
| 0000000005 | "___,___,&0_.__&NET" | _________$0.05_.NET |
| | | |
| +0000000005 | "___,___,$0_.__-*" | _________$0.05_* |
| | | |
| -0000000005 | "__,___,__0.__&CR" | __________.05_CR |
| | | |
| -0000000123 | "___,___,___.__-" | __________1.23- |
| | | |
| 0000001234 | "__,__*,___*__" | ******,012*34 |
| | | |
| 0000001234 | "___,_$0,___.__-SALES" | ______&,012.34_SALES |
| | | |
| 0000135678 | "__,___,___.__&CR&-NET" | _____1,356.78_CR__NET |
| | | |
| 0000135678 | "__________&&PROFIT" | ____135678__PROFIT |
| | | |
| 0000135678 | "$0_________-$NET" | $_000135678__NET |
| | | |
| 0000135678 | "__,___,___DOLLARS__CENTS" | _____1,356DOLLARS78CENTS |
| | | |
| +0000135678 | "$__________&-&NET" | $____135678___NET |
| | | |
| +0000135678 | "__________&CR&NET" | ____135678____NET |
| | | |
| +0000135678 | "0_________" | _000135678 |
| | | |
| +0000135678 | "__________" | ____135678 |
| | | |
| +0000135678 | "$&0_,___,___.__&NET" | $__0,001,356.78_NET |
| | | |
| +0000135678 | "__,___,__*.__*CR**" | *****1,356.78*__** |
| | | |
| -0000135678 | "*_________" | *000135678 |
| | | |
| -0000135678 | "_________*" | ****135678 |
| | | |
| -0000135678 | "__________" | ____135678 |
| | | |
-----------------------------------------------------------------------------------------------
Table 9-6. Examples of Edit Words (cont.)
-----------------------------------------------------------------------------------------------
| | | |
| Input | Edit Word | Edited Result |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| -0000135678 | "_________0" | ____135678 |
| | | |
| -0000135678 | "__________&CR&NET" | ____135678_CR_NET |
| | | |
| -0000135678 | "__________&-&&NET" | ____135678_-__NET |
| | | |
| 0000135678 | "__________&NET&CR" | ____135678_NET___ |
| | | |
| -0000135678 | "__________&NET&CR" | ____135678_NET_CR |
| | | |
| -0000135678 | "$__________&-&NET" | $____135678_-_NET |
| | | |
| -0000135678 | "_______&0__&CR" | ____$135678_CR |
| | | |
| -0000135792 | "__,___,_*_.__&-" | *****1,357.92_- |
| | | |
| -0000135678 | "__,___,___.__&CR&&NET" | _____1,356.78_CR__NET |
| | | |
| -0001356789 | "___,____&0.__CR" | ____$13,567.89CR |
| | | |
| -0034567890 | "___,___,_&0.__CR**" | ___$345,678.90CR** |
| | | |
| -1234567809 | "_______&0__&CR!" | $1234567809_CR |
| | | |
| +1234567890 | "*_________" | 1234567890 |
| | | |
| -1234567890 | "___,___,_&0.__-" | $12,345,678.90- |
| | | |
| -1234567890 | $&__,___,_0_.__&-&GROSS" | $_12,345,678.90_-_GROSS |
| | | |
| -1234567890 | $&__,___,__0.__CR" | $_12,345,678.90CR |
| | | |
| -1234567890 | "_,___,___,___-OLD&BALANCE" | 1,234,567,890-OLD_BALANCE |
| | | |
-----------------------------------------------------------------------------------------------
Comments (Columns 71-74)
Enter comments of any kind in the comments field.
Program Name (Columns 75-80)
The program name field contains the program name. The format of this
field is discussed in Chapter 2.
MPE/iX 5.0 Documentation