Use Cases Implemented by the Program Call Stack¶
The call stack consists of three RPG36 programs: AP765P
, AP765
, and AP765N
. Together, they implement a system for generating Vendor 1099 forms for tax reporting. The primary use case is:
- Generate Vendor 1099 Forms:
- Description: The system collects and validates input data for 1099 forms, processes vendor data from a file, and prints either two (
AP765
) or three (AP765N
) 1099 forms per page on laser paper. The process includes validating user inputs, formatting vendor names and addresses, mapping payment amounts to specific 1099 form boxes, and printing forms with totals. - Components:
AP765P
: Interactive screen program to collect and validate user inputs (e.g., headings, company ID, amount, type, current/last indicator).AP765
: Processes vendor data and prints two 1099 forms per page.AP765N
: Processes vendor data and prints three 1099 forms per page, likely an updated version for higher throughput.
Function Requirement Document¶
Vendor 1099 Form Generation Function Requirements¶
Overview¶
This function processes vendor data to generate IRS 1099 forms, formatting and printing either two or three forms per page on laser paper. It validates input data, formats vendor/payee names and addresses, maps payment amounts to specific form boxes, and accumulates totals.
Inputs¶
- Company Information:
HEAD1
,HEAD2
,HEAD3
(30 chars each): Company headings (e.g., name, address).ID#
(10 chars): Company tax ID.ENTAMT
(8 chars, 2 decimals): Total amount for validation.TYPE
(1 char): Form type ('D' for Dividend, 'I' for Interest, 'M' for Miscellaneous, 'N' for Nonemployee Compensation).CURLST
(1 char): Current ('C') or Last ('L') year indicator.CNYEAR
/YEAR
(4 chars): Calendar year for the form.- Vendor Data (from file
AP766
): VNDEL
(1 char): Delete code.VN1099
(1 char): 1099 code ('M' or 'N').VNVEND
(5 chars): Vendor number.VNNAME
(30 chars): Vendor name.VNADD1–VNADD4
(30 chars each): Address lines.L1AMT1
,L1AMT2
(9 chars, 2 decimals): Payment amounts for two boxes.BOX1
,BOX2
(2 chars): Box numbers (1, 3, 6, or 7) for 1099 form fields.VNID#
(11 chars): Vendor tax ID.VNPYN1
,VNPYN2
(40 chars each): Payee names (optional).VNNOVF
(1 char): Name overflow flag ('Y' or blank).STATID
(8 chars),STATED
(9 chars, 2 decimals): State-related fields.
Outputs¶
- Printed 1099 Forms (to printer file
AP1099
): - Two forms per page (
AP765
) or three forms per page (AP765N
). - Fields: Headings, company ID, vendor/payee names, addresses, vendor number (as account number), amounts in boxes 1, 3, 6, or 7, year.
- Totals: Count of forms, total amounts for boxes 1, 3, 6, 7.
- Error Messages (if validation fails):
- Returned as a list of strings for invalid inputs.
Process Steps¶
- Validate Input Data:
- Check
HEAD1
,HEAD2
,ID#
are not blank. - Verify
TYPE
is 'D', 'I', 'M', or 'N'. - Ensure
CURLST
is 'C' or 'L'. - Return error messages for any invalid inputs.
- Process Vendor Records:
- Read vendor data from
AP766
. - Validate that
L1AMT1
+L1AMT2
equalsENTAMT
. Skip record if invalid. - If
VN1099
is 'N', mark as Nonemployee Compensation; if 'M', mark as Miscellaneous (optional inAP765N
). - If
VNVEND
is 9384 (AP765
) or 32800 (AP765N
), set a flag (YES
). - Format Names:
- If
VNPYN1
is blank, useVNNAME
; otherwise, useVNPYN1
andVNPYN2
(if provided). - If
VNNOVF
is 'Y', format name to continue on a second line. - Format Addresses:
- Select highest non-blank address line (
VNADD4
toVNADD1
) for city/state/zip; shift lower lines to address fields. - Map Amounts:
- Assign
L1AMT1
andL1AMT2
to box 1, 3, 6, or 7 based onBOX1
andBOX2
values. - Print Forms:
- Accumulate up to two (
AP765
) or three (AP765N
) forms per page. - Print fields: headings, year, company ID, vendor ID, vendor number (as account), payee names, addresses, amounts.
- If fewer than the maximum forms remain at end-of-file, print remaining form(s).
- Accumulate and Print Totals:
- Track count of forms and sum amounts for boxes 1, 3, 6, 7.
- Print totals at job end.
Business Rules¶
- Mandatory Fields:
HEAD1
,HEAD2
,ID#
must not be blank. - Valid Type:
TYPE
must be 'D', 'I', 'M', or 'N'. - Valid Year Indicator:
CURLST
must be 'C' or 'L'. - Amount Validation:
L1AMT1
+L1AMT2
must equalENTAMT
. - Payee Names: Use
VNPYN1
andVNPYN2
if provided; otherwise, useVNNAME
. - Name Overflow: If
VNNOVF
is 'Y', extend name to second line. - Address Formatting: Use highest non-blank address line for city/state/zip; shift others to address lines.
- Box Mapping: Map amounts to boxes 1, 3, 6, or 7 based on
BOX1
andBOX2
. - Form Layout: Print two (
AP765
) or three (AP765N
) forms per page on laser paper. - Vendor Number: Print
VNVEND
as account number. - Form Type: Support Miscellaneous ('M') and Nonemployee Compensation ('N') forms; 'M' check is optional in
AP765N
. - Totals: Accumulate and print total forms and amounts for boxes 1, 3, 6, 7.
Calculations¶
- Total Amount Validation:
TOTAMT = L1AMT1 + L1AMT2
. Compare withENTAMT
. - Form Counter: Increment
COUNTP
(1 to 2 forAP765
, 1 to 3 forAP765N
) to track forms per page. Reset to 0 after printing. - Running Totals:
COUNT
: Increment by 1 per form.LRAMT1
,LRAMT3
,LRAMT6
,LRAMT7
: Sum amounts for boxes 1, 3, 6, 7, respectively.
Error Handling¶
- Return error messages for blank
HEAD1
,HEAD2
,ID#
, invalidTYPE
, or invalidCURLST
. - Skip vendor records if
L1AMT1
+L1AMT2
≠ENTAMT
.
Assumptions¶
- Input data is provided programmatically (not via screen).
- Output is formatted for a printer file (
AP1099
) compatible with laser paper. AP766
file contains valid vendor data.