
IFOP Notes

This file contains the text for the numbered documentation notes in IFOP.COB.


1. ** WRT creates the VT-coded display strings for the screens defined with
the RDxx procedures (the static display data), 80 or 132 columns, so must be
called following such a procedure (immediately or after adding variable
data). ** TSTART, which is 1 unless set higher in the RDxx procedure, is for
the rare cases where the display does not start from row 1. ** Before the
display, the screen is erased from the start row to the end, regardless of
how many lines will be displayed. ** "^" and "!" define reverse and bold
fields, up to the following "]" or end of line; these symbols occupy a
character position in the final screen; "|" is reverse just for itself
(rarely used). The row/column VT codes for each field are calculated from
their position within the strings defined in the RDxx procedure. ** It is
impossible to predict what is the largest possible number of bytes for the
whole screen -- it depends on the number of fields, their length, and number
of control strings. So rather than a large safe size (perhaps 10,000), TSTR
is just 2000 (this value is also used in WRT-F), and if the actual size is
larger, the screen is displayed in several stages: the accumulated size is
checked after each line, and is displayed and cleared when passing 1500. The
size checked (1500) must be much smaller than TSTR, to allow for worst case
per line, since a line can be much longer than 80 or 132 when there are many
fields (because of the control strings added for each field -- position,
bold, etc.); however, spaces in the text between fields or after the last
field on a line are not included (TLTH in WRT-F is then 0). ** The logic
reads lines in TD-SCREEN up to "??" or line 24. Screens with a variable
number of lines do not end with "??", so must add this line outside the RDxx
procedure (as in the "more/end" inquiries ON, CO, AQ, etc.); otherwise it
will continue to read to line 24 and display whatever happens to be in those
lines from previous displays. Also, must add a line with "??" if the logic
overwrites the "??" present in the screen definition (e.g. RD92).

2. ** SDR-DSP is called by SHOW-DRAWING, which sets SDR-OP (0 - 4),
SDR-FIRST, and SDR-NUM to define the scrolling request (if any) and the
portion of drawing to re-display after scrolling. ** The scrolling region is
normally text lines 1 - 24; for OP 1 - 4, restrict it to lines 1 - 23 while
scrolling (to prevent scrolling the display on line 24), then restore it to 1
- 24. Scrolling up or down is done by deleting or inserting text lines while
the cursor is on line 1: for OP 1 and 2, scroll 3 text lines, which are 10
sixel lines; for OP 3 and 4, scroll 23 text lines (in effect clearing the
display area except line 24). ** Do not insert $- after the last line
displayed, because this scrolls the display up one line on some terminals
(even when it is not on the bottom screen line, and despite the "no scroll"
definition in TX-SIXY).

3. ** When used in Irvine Tools, the Irvine Fasteners files are accessed;
TOOLS and TOOLPROD are not used in Irvine Tools, and this procedure is only
needed there for the Irvine Fasteners tool lists. In this case IFTOOLS and
IFTOOLPROD must be open when calling it. ** This is not a loop, it only needs
to read one TOOLPROD record to get any tool list that uses this assembly,
because they are all identical (i.e. contain the same tools). It then looks
for the line with the assembly field number, and when found it is always the
right one because of the way TOOLPROD is maintained, so the various checks at
that point are not really necessary. After call, it is assumed the TOOLS tool
list read here is still in TS-REC (for example, to scan the fields to find
the tools that belong to this assembly). If something is not found, A-S1 is
set to 1, to indicate that the processing for that assembly must be skipped.
Calls TL-SET-TYPE and sets TL-ASTN and TL-ACAT.

4. ** Records are added to REPFL in two separate loops. Normally, the second
loop should find all REPFL records created by the first loop, but this logic
allows for records that are unique in either the first or second loop. Both
loops use WRITE/REWRITE logic, because they must accumulate the qty and amt
fields; in the first loop only the qty (amt will be added by second loop); in
the second loop only the amt (qty field is not disturbed). ** In the second
loop, if the M.O. is not found (should never happen, because it cannot be
left 0 in the ISS/OUT transaction), create one special line and subtotals in
report with sum of all these cases by clearing all key fields.

5.1. FF361 - FF404 are used in CB and GR.

5.2. See note 5.1.

6.1. ** Try to match invoices to payment detail lines; in all cases, match
the absolute values, since payment can be negative (for adjustments).
"Payment" means payment detail line in RMR line (there may be several per
cheque). If payment is under RMAX do not look for a match, apply it directly
to the exception total. Allow RMAX rounding difference for all the invoices
for one B/L (or just one invoice when this is the match found); the total of
all differences is added at the end as exception transaction. ** The
individual invoices are listed as IT1 lines following the RMR, but ignore
these lines and use instead the invoices found in TRANS through the B/L read
in RMR (it is assumed they are the same); so the cheque amt is ignored --
only the individual B/L payments (which are the sum of the IT1 line amounts)
are used, and assumed to total the cheque amt. ** For customer 06620 (Saturn)
must use the IT1 lines, because they may pay several small amounts for the
same invoice, referring to the same B/L in several places, so these amounts
are applied to TRANS as they come; so here it is the IT1 amounts that are
used, and the B/L payment (their sum) is ignored. To find the right TRANS
record, the product in IT1 is compared with the one in SALIN, using the order
number in TRANS. But they may also pay the whole amount in one IT1 entry, so
to allow for this, a smaller rounding limit is used for each entry, and if
within limit it is assumed this is the whole amount. ** Each RMR creates one
SORTFL record; RSEQ counter is for uniqueness, in case a B/L has more than
one payment (probably never happens, and the invoice matching logic later may
not deal with this case properly). Then, when reading SORTFL, each
transaction (original or created by the system as exception) creates one
REPFL record and hence one line in the report. ** Matching logic: First, see
if payment = all invoices of that B/L. If not, then if the B/L has only one
invoice, apply it anyway and show the balance in the final report. Otherwise
see if payment = all invoices but one (the total of all invoices is kept from
previous trial, and each invoice is subtracted in turn). If not, see if
payment = any one invoice. If no match is found, add the payment as exception
transaction. Each line in the report represents one invoice (real or created
now as exception).

6.2. See note 6.1, with the following differences. ** Here the matching
criterion is not +/-RMAX but +/-2% of invoice value; in JS-C, compare with
the rounded +/-2% value (which is the way the customer calculates the
payment, not just as JS-PAY-AMT >= A-D1 * 0.98 AND <= A-D1 * 1.02, which
compares exact values), since a fraction of a cent would place it outside
this range. The initial check that payment itself is under RMAX is the same.
** Here a customer may use either invoice or B/L as payment id in the RMR
line (most use invoice). Use TRANS to determine: if invoice, simply apply the
payment to that transaction; if not, assume it is B/L and use the elaborate
logic of JF (perhaps in this case there are additional lines within the RMR
for the individual invoices, if so they are ignored; in JF these are the IT1
lines, used only for Saturn). In B/L logic, the rounding amount is for the
whole payment, and is shown with the first invoice (this is why JS-D2 is
cleared after the first iteration). ** SORTFL and REPFL are re-created for
each BPR section, same as in JF, but in JF there is only one BPR section per
ST, since there is only one cheque; so here too one BPR line may create
hundreds of records in SORTFL, when a customer pays many invoices with one
cheque, but most BPR's will create just one or a few records. ** The
uniqueness counter RSEQ, created for SR key (as in JF) is known to be needed
here, and is also included in RP key (in JS-W), for case where several
payment detail lines refer to the same invoice. This case is handled
correctly by the general logic: each detail line in turn is applied to that
invoice, and shows exception "1" (it is smaller than the invoice, since the
system does not know at that point that more detail lines are following); and
the last detail line has no exception code (if the total details is within
rounding limit).

7. ** LA-RECORD is initialized before calling SET-LA, and written after
returning from SET-LA. The operations in SET-LA are the last thing done
before writing the LA record; some of them depend on LA fields, so these
fields must be set before calling SET-LA. ** LA-SRC=1 means production labels
(created manually in CE, in the M menu), and 2 means shipping labels (created
in ID, in the S menu); the option LA-SRC=0 is no longer used (labels created
automatically in IS with the lot -- now the labels are only approved there,
and created in CE). Production generates standard or GM standard labels,
shipping generates shipping labels (placed on top of the production labels
when shipping). But there are exceptions: the shipping label may be created
directly in CE, to save relabeling later -- this is identified by a value in
P-ORD (the blanket order no.), used to get the customer P.O. from the order
record; P-ORD may be used for production labels too, if this is preferred to
entering the P.O. in CE. For production, LA-CUS determines the label type and
must be taken from P-CUS, since these labels may be created without a
specific order; for shipping, LA-CUS could be used (it is then set from O-CUS
in the actual order), but to be consistent C-LABEL is used, because SET-LA is
called from the S menu only in ID, when C-RECORD is in memory, and never for
GM (for which the label file is created directly). For some types the
production conditions may never be used, since only shipping labels are
created. The condition P-CAT=2 or 4 is for GM, and it must precede the LA-CUS
conditions for production labels (since category overrides customer); it is
not needed for shipping labels (since SET-LA is not called for GM shipping
labels), but if used in the future it must follow the LA-CUS conditions,
since in this case customer overrides category (must allow for the case when
a product is shipped to a customer different from the one in P-CUS). When
setting LA-CUS from P-CUS (for production labels), it must be set before
call, because it must be taken from the alternate product, not the generic
product, and SET-LA may be called when either one is currently in P-RECORD.
But P-NO, P-CAT, P-PACKING, also used here, are expected to be the same in
both, so they can be used directly from P-RECORD. ** AmAx no longer uses
SET-LA and BAR-LAB (BAR-LAB-AMAX is called only directly), so C-LABEL=3 never
occurs; but there may still be references to LA-TYPE=9 here and in BAR-LAB --
they may be left, the condition is simply never encountered.

8.1. Add dummy bin to BINALLOC with bin value that will cause it to be read
after all the real bins, to print a DLOC line in the bins column in ID-BLINE.
This is the simplest way to print this line, otherwise needs to add logic to
do this after reading the last bin and to take into account the column
completion indicators ID-KL, ID-KB. The dummy bin is deleted when ending the
printing for that product.

8.2. See note 8.1.

9. ** COST-DISP must be executed only after COST-CALC: it uses CST- fields
calculated there, P- fields as they were there, and CST-KQ as it was set for
COST-CALC; CST-KDIS=1 indicates actual display, else the screen image is
printed. ** Uses 132-column display, but WRT132 and WRT80 must be called
before and after calling COST-DISP; calling them here may interfere with the
132/80 setting in the section that calls COST-DISP.

RD92 screen with field markers (all fields, when CST-KQ=0):

...................................   !PRODUCT:]............     ......................     !MACHINE:]..
...................................             ................................                      ..............................
...................................             ................................
                                                ................................            !SUGGESTED SELLING PRICE (CDN):]....:...
!PRICE (CDN):]....:...  .........               ................................
!WEIGHT GROSS,NET:]....:.. ....:..  ........    ................................
!OPERATIONS:] ... ... ... ... ... ... ... ... ... ... ... ...

^MATERIAL COST                  ]   ^THIRD PARTY COST                   ]   ^CONVERSION COST                    ]    ^ERRORS:      ]
 ..................... ....:...-     .... .................... ....:...-     .... .................... ....:...-      .. .. .. .. ..
 PROCESS  .....        ....:...-     .... .................... ....:...-     .... .................... ....:...-      .. .. .. .. ..
!MATERIAL SUB-TOTAL    ....:...-]    .... .................... ....:...-     .... .................... ....:...-
                                     .... .................... ....:...-     .... .................... ....:...-
                                     .... .................... ....:...-     .... .................... ....:...-
!NUT:] ............      ....:...-        FREIGHT & HANDLING   ....:...-     .... .................... ....:...-
                                    !THIRD PARTY SUB-TOTAL     ....:...-]    .... .................... ....:...-
!DIRECT COST SUB-TOTAL:] ....:...-                                                TOOLS                ....:...-
!GENERAL OVERHEAD:     ] ....:...-  !CONT: ..-%] (....:...-/....:...)             SHIPPING CARTONS     ....:...-
!TOTAL MFG COST:         ....:...-] !G.M.: ..-%] (....:...-/....:...)       !CONVERSION SUB-TOTAL      ....:...-]  (..... .....)

^HISTORY    MAC   MATERIAL   THIRD PARTY   CONVERSION ]    ^HISTORY    MAC   MATERIAL   THIRD PARTY   CONVERSION ]
 .......... ..    ....:...     ....:...     ....:...        .......... ..    ....:...     ....:...     ....:...
 .......... ..    ....:...     ....:...     ....:...        .......... ..    ....:...     ....:...     ....:...
??

10. In IN the fields are displayed using this description table, but in other
places the index for O-PACKS HO-PACKS FO-PACKS IE605 is used directly
(cartons=1, triwalls=2, buckets=3-5, bins=6-9); also, WEI-WT(1), etc. are
used directly in places unrelated to IN logic (e.g. subcontractor B/Ls). So,
if modifying the order, or if adding new entries, find all uses of -PACKS,
IE605, WEI-WT, WEI-PK. All tables have 12 entries (currently 3 spare, but
WEI-WT must be 0 for these, since some loops read all 12).

11. D-WDIFF adds D-DAYS working days to D-DATE; D-DAYS can be <0, 0, >0.
If D-DAYS=0, result is first working day on or after D-DATE; to get first
working day on or before D-DATE, add 1 to D-DATE and call D-WDIFF with
D-DAYS=-1. Do not use with large D-DAYS -- it checks one day at a time so it
is slow.

12. JB-NUM (listed in the CURR/FUT columns) is calculated as tons for those
processes with cost mode "G" or "N", and as number of hours for those with
cost mode "M" (or an invalid mode).

13. ** LG-QTY must be set before calling LG-ADD -- this is the qty in the
extension to be added. ** HO-RECORD is in memory at this point: if extension
was found, the record was read earlier; or it was added or found in LG-ADD
(if not, A-S1 is set and this part is bypassed). Normally, only when adding a
new extension needs to update the HO-SHxxx and HO-DOCK fields, but they are
always updated (in case they were modified in an existing pair -- no check is
made for this; they are also updated for HO-IND>2, when the qty can no longer
be updated). Update the PO (CUSORD) field too, so that the current PO is
printed in the header of picking tickets and invoices, rather than the one
from the original blanket order; but allow for customers that do not send the
PO with the 862, so CUSORD could be blank. ** DY-FRD (and MT-FRD) are used
only in LG, and only to skip pairs earlier than SYS-DATE that were already
read; they are set for all pairs read, but checked in LG5 only for the
earlier pairs.

14.1. ** NU-BOLT will be either a generic or an alternate part (for Victaulic
it is alternate, for others it is generic); this operation simply places
whichever part has a value in P-NUT (P-NUT must not have a value in both the
alternate and the generic). When NUTBOLT is used (in BI, BB, KL, etc.) to
read the orders with that bolt, the bolt will then be the correct part,
either generic or alternate, just as it is used in SALIN, MATREL, DAYREL
(when the generic has the nut, it is always the generic that is used in
orders). This also means that these operations must read the orders directly
for that bolt (rather than through ALTERNATES, as is done for regular bolts),
since only the one bolt from NUTBOLT is relevant (the generic bolt must be
used to scan ALTERNATES, so if the alternate is used in NUTBOLT no records
will be found and hence orders will be missed). ** SALIN, MATREL, DAYREL have
an entry only for the bolt, so both bolt and nut, when read in the main
product scanning loop, will find this one entry: the bolt normally, and the
nut through the bolt read in NUTBOLT.

14.2. See note 14.1.

14.3. See note 14.1. For mac 99, no M.O. is generated; instead, a record is
added to MAINTB (to print a line in the "suggested requisition" report) for
all products that reach this point, regardless of values (if no qty is
needed, "no run out" is printed). An M.O. is then created manually, and the
other requisition report, in KM, shows it when the M.O. is firmed.

14.4. See note 14.1, but here the qty for the generic and the alternates must
be added under the generic (one total for all, since only the generic is
listed). So the SORTFL key has the generic, but SALIN, MATREL, DAYREL are
read through the alternate; and the NUTBOLT logic must read the actual
NU-BOLT record to check whether it is an alternate or the generic.

15. LKWAIT makes the program hibernate for the specified period. It is used
to set the wait time for the retry loop in certain file reading operations
(when the same record has been read by another user and must be locked before
being modified). LIB$WAIT rounds value to 0.01 seconds, so this is the
smallest safe value (less may end up as 0); it matches the expected wait time
(about 0.5 msec for read, 10 msec for rewrite).

16.1. ** RDR-INFO must have been performed before calling SET-DEM-DATE,
ADD-DEM, SUB-DEM, since they use IF-DEM-DATE. ** ADD-DEM, SUB-DEM: when
P-NUT>" " should update nut demand too, but this is only done in BN-L, so the
nut demand may be inaccurate before running BN.

16.2. ** MATREL qties are subtracted when reading MATREL record, and added
after the changes (when deleting record, the qties are only subtracted --
MT-IXF is set to 0 to prevent any addition). The result is added to the
product demand qties -- this updates in effect these qties according to the
changes. ** When P-NUT>" " should update nut demand too -- see note 16.1.

17. ** Days are actual number of days in these calculations, but are kept as
working days in the system; for example, lead-days must be multiplied by 7/5
in the calculations. ** M.O. number logic: All M.O.s generated are first
assigned consecutive numbers starting with 1001; previous M.O.s in this range
(the "temporaries" from previous run) are simply replaced with the new ones;
at the high end, if more are needed new ones are created, and if fewer are
needed the old ones are canceled (R-IND set to 0); so R-IND=1 indicates
actual temporaries. In KM-FIRM (following KL), the M.O.s with start date up
to 28 days ahead (or all M.O.s if machine=99 or product category=42 45 48)
are "firmed" -- their number is changed to a 5-digit number (next number
available in a certain range, which depends on product category (tables
KM-RMINTBL KM-RMAXTBL)), and the 4-digit one is canceled (R-IND set to 0). At
the end, the 4-digit ones left with R-IND=0 are deleted, and the others
become the new temporaries.

18.1. HL-QTY-ALPREV and HL-WEIGHT-ALPREV are also set, because this operation
takes place between the first and second allocation, so here it must behave
just like the first allocation. For Victaulic-type nuts, assume the same qty
is allocated for nuts as for bolts.

18.2. Modify the qty allocated on this line and clear it in all the following
lines, if any. See also note 18.1.

19. LS-ORDW can be 0 in the last order if it could not satisfy even one
carton.

20. Calculate anticipated start dates by adding M-HOURS (machine available
hours) for each day and subtracting the required production hours for each
M.O. The M.O.s are read in the order they are to be started. The machine late
date is set as the calculated date, so it can also be earlier than the
required start date; if equal to the required start date it is left 0. The
late date is thus in effect the anticipated actual start date, earlier or
later than the original one; and when 0, it means it is the same as the
original one. Must ensure that M-HOURS>0, else adding it to KM-MTOT will not
increase it, causing an infinite loop; it can be 0 also if the MACHINE record
was not found (there is no check for this), which can happen if P-MAC or
MQ-MAC is wrong; this should never happen, so M-HOURS is simply set to 15
(typical value), and the wrong machine will be discovered later in reports.

21. HO-IND=1,2: cancel allocation and clear HL-QTY-AL. HO-IND=3: keep
allocation and HL-QTY-AL; make B-QTY-AL match BINALLOC (B-QTY-AL was cleared
first in all bins). All others: cancel allocation and leave HL-QTY-AL
unchanged. BA-IND is used to mark the BINALLOC records that must be kept.

22.1. DSQ messages are for those sections (currently IW and LW) used when
IFOP is accessed through mobile scanners, with small display (16 lines x 20
characters). The message numbers parallel those of the regular DSP messages.
Messages longer than 20 characters are formed so as to be split and displayed
by DSQ-ERR on 2 lines. Individual messages in IW and LW follow the same
logic.

22.2. See note 22.1.

22.3. See note 22.1.

23.1. ** For heat treatment processes use weight instead of qty (for them
M-TQTY represents weight, not qty). ** M-OLD is the current machine in all
subtotal levels; for grand totals, M-OLD is set to 0 to force NOT PROC-HEAT,
and thus use qty rather than weight.

23.2. PROC-HEAT: see note 23.1.

23.3. PROC-HEAT: see note 23.1.

24. HO-IND can be 0 (then set it to 1), or 1 (when a previous line on the
same order was read earlier in this loop and set it from 0 to 1), or 2 (then
leave it as 2). See also the previous loop, where SHIPLIN records are
selected only for HO-IND 0 - 2, and HO-IND is set from 1 to 0, and 2 is left
unchanged.

25. ** BA-QTY-PACK=0 is an error; in this case leave BA-CARTONS=0, and this
will be seen on picking tickets. ** Allocate full cartons only, so BA-PARTIAL
is never set (since Jan 09).

26.1. Use the HO- field instead of the equivalent O- field when the field may
have been modified in HO-RECORD without also placing the value in O-RECORD;
or when the HO- field has to be different from the O- field (as in shipping
labels for blanket orders, where it may change with each shipment, and the O-
field may or may not be blank). In some cases the HL- field may be different
for each line, so must start the search from there; hence the GET-HLCUSORD
logic.

26.2. See note 26.1. Also applies to HO-VIA, etc.

26.3. See notes 26.1, 26.2. Also applies to fields that change for each
invoice when there is more than one invoice against the same order in the
same shipping cycle: HO-INVNO.

27.1. ** Set R-PUR if the primary machine in the worksheet records is 8
(purchased part); this is used only in CALC-QLEFT (also called here, at the
end of the loop). This is the simplest way to set it; it is harder to set it
in DE, and it does not need to be set as soon as that worksheet is created --
at the end of the day is adequate. P-MAC=99 (which also indicates purchased
part) cannot be used as criterion, since many parts have a regular machine
but are also purchased sometimes, and only then the worksheet machine is 8.
** For secondary processes: J-AWEIGHT is set from the J-WEIGHT of the primary
processes. Set BKWRONG if the total bucket weight exceeds the primary
processes total weight BN-WEIGHT. WORKSHEET records are read in process
number order, and all primary processes come before the secondary ones, so
BN-WEIGHT correctly reflects the total primary processes when used for the
secondary ones. ** No WORKSHEET changes are made before M.O. is complete or
after it is closed.

27.2. CALC-QTY-WEIGHT and BUCKET-CALC: Since 2008, buckets are no longer
weighed at the primary machines, so for them J-WEIGHT is calculated from
J-QTY in DE, and J-AWEIGHT is set equal to it in both these procedures (same
as for worksheets with no buckets). Bucket numbers are still entered for them
(to record their process later), but their weight is never filled in.

28. See if the same bucket was used in the last 3 days for the same M.O. and
machine. But if the bucket found is the very bucket currently checked (entire
key identical), ignore it; this can happen only if users enter by mistake the
same bucket twice for the same worksheet, and this will be caught later, when
trying to WRITE the bucket.

29.1. ** Use L-PROD (rather than PL-PROD) for MT-PROD, in case order has
several product lines for the same plant, and hence several PLANT records
with the same order. In this case the first of these duplicates is always
read, which is OK for PL-PLANT (the same for all lines), but not for PL-PROD
(may access the wrong MATREL record). ** If there is an older record in PLANT
with the same order no., the system will read it instead of the correct one
(because it was created earlier, and PL-KO allows duplicates), and hence will
get a wrong plant and will not find the MATREL record. This seems to happen
quite frequently, because users do not delete the old PLANT records when
creating new ones for the same order. What they see then is that the qty
shipped is not being updated (or, for BB note 29.2, that the MATREL qties are
not reflected in the backorder qty).

29.2. See note 29.1.

30.1. Calculate sum of qty/weight of all previous worksheet entries with the
same machine/process, to check later that this sum plus the qty/weight
entered now do not exceed the total qty/weight of the primary machine entries
(for Irvine Tools the primary machine is taken to be the first process in the
operations string). PROC-REJECT must reduce the total (except for Irvine
Tools, where these processes mean something else). Also, by subtracting it,
this takes care of the situation where current worksheet is PROC-REJECT:
later when checking the current qty/weight, PROC-REJECT can be treated like
the others (i.e., total PROC-REJECT entries cannot exceed total primary).
When reading the previous worksheets, ignore the one entry (if any) with the
key equal to the key entered: this can happen only when the user intends to
modify an existing entry -- in this case the qty/weight check must be done on
the sum excluding the entry itself, plus the qty/weight entered.

30.2. See DE logic and note 30.1. Here, however, if a worksheet with the same
key exists, instead of modifying its qty the new qty is added to it;
therefore, no need to check for such a worksheet and subtract its qty from
the total.

30.3. See DE logic and note 30.1. Calculate sum of qty/weight of all previous
worksheet entries with the same machine/process, to check later that this sum
plus the qty/weight entered now do not exceed the total qty/weight of the
primary machine entries. Here, however, if a worksheet with the same key
exists we will not modify its qty, but add the new qty to it; therefore, no
need to check for such a worksheet and subtract its qty from the total.

31. Here the left portion of PREC (product description fields) may have data,
so it must be saved and restored, to be printed on the next page. In reality
there is a need to save only in the case of the nut lines in a Victaulic
product, because only then the end of page can occur while printing the
description lines; for others this would trigger a new page through HL-PAGE,
so a new page can occur only when there are >28 bins, and in this case
ID-KL=1 and the left portion of PREC is blank.

32. ** Initialize SS-Kx, WAx, SS-TITLE here rather than before each prompt,
because some of the prompts are bypassed, depending on earlier answers. **
SS-TITLE and FF4 are X(52), so the total of the three strings should not
exceed 52.

33.1. ** R-LMAT and R-LPROC are set in this report and used in RS: R-LMAT=0
means qty on hand >0; R-LPROC=0 means qty on hand and processed >0 (annealed,
ready to use). If an M.O. is skipped in the REPFL creation loop, the
indicator is not set in the main loop, so in RS will be shown as qty on hand
>0. ** R-QTY-ORD can be 0 only if changed manually (system never generates an
M.O. with qty 0) -- here it is verified simply to prevent listing such
orders.

33.2. See note 33.1; logic applies here to R-LTOOLS, and 0 means qty on hand
> (0 for tools, 2 for assemblies). The indicator must be set if qty is low
for any one of the tools required, so R-LTOOLS of a certain M.O. may be set
in more than one pass in the main loop.

34. When the same tool is used more than once in a tool list, create only one
REPFL record. RP-F100 counts the number of such records (normally 1). When
reading REPFL, this number is multiplied by R-QTY-ORD to calculate the total
number of tools of that type required by that M.O.

35. ** NR-TOT and NR-QTY count number of tools with 3 decimal places, so that
they can keep track of "fractions of tools" as may be calculated from each
M.O. qty when dividing by PH-LIFE/1000. (When printing NR-TOT, it is
rounded.) This is needed because rounding to integer for each M.O. would
cause gross errors -- some M.O.s may need only a small fraction of a tool's
life expectancy. ** Condition IF NR-ASM=0: for assembled dies PH-LIFE=0, so
cannot calculate the qty needed; instead, assume a minimum of 2 assemblies
required to start any job.

36.1. The LSTEP logic: Starts with LSTEP=0 and qty on hand in NR-TOT; main
loop reads M.O.s in required date order and deducts each one from NR-TOT;
when NR-TOT goes below 0, LSTEP becomes 1 and the qties on order are added;
then, when even this goes below 0, LSTEP becomes 2 and this is run-out.
R-LDATE is set from this logic (date of M.O. that caused LSTEP=2), but
R-LTOOLS (for RS report) is set based on qty on-hand only (M.O. that caused
LSTEP=1). If LSTEP=2 was not reached, it means that there is "no shortage" or
NR-KERR=1 or NR-KMIN=1; in these cases, print nothing for this tool. In
addition, even if LSTEP=2 was reached but NR-KSV=0 (the total tool shortage
did not go above -1, and would be shown as 0), print nothing for this tool.

36.2. See note 36.1, parts common to tools and material. R-LMAT is set like
R-LTOOLS; R-LPROC is set even earlier, in the middle of LSTEP=0, when qty on
hand with process code>0 ends (qty with proc=0, kept in PH-PROC-HAND(1), is
unprocessed, hence unavailable).

37. ** CFORD has data from several consecutive SHIPORD orders. The condition
FO-LINES=0 is used in several places to check if this is the first order in a
B/L. The FO- values are set only for the first order, since all should be the
same. For PKTYPE, the value is used for the first order, and for the
following ones it is replaced with "MIX" if different. Cartons, triwalls, and
buckets values are added to total kept in FO-. Pallets can be entered only
for first order, since they apply to entire shipment. PLANT must be checked
only for first order, since there may be two orders pointing to the same
PLANT record (different shipto) but only one can be in PL-ORD (so that one
must be used as first order in the B/L, else will get the error message). **
FO-DXNO (set here) is used for all that use DX data, and FL-DXNO (set later
in line loop) just for AmAx. AmAx needs it when several HO records end up in
the same B/L, i.e. FO, as separate FL lines, since each one has its own DX
data. But AmAx also needs FO-DXNO, since ED-ADOCK is needed in the LOC+11
segment in DESADV before the CF lines loop; so FO-DXNO is overwritten here by
each consecutive HO-DXNO, and the dock from the last one will end up in the
LOC+11; presumably all the orders they group in the same B/L have the same
dock.

38. ** RDADJ-PNO tries to read the product with the given no.; then if not
found, the one without the "0" prefix, if any; then, if not found, the one
without the "00" prefix, if any. ** EXTEND-PNO prefixes the product no., if
less than 8 characters long, with enough "0"s to make it 8 characters.

39. ** REPFL is needed in extra step to sort by M-OPDESC (contractor name) --
it is impossible to create this sorting in SORTFL, because SORTFL must be
sorted by M.O. for the logic that searches, compares, updates, etc. records
in the JI5 loops after they are created. ** There may be several "in" and
several "out" entries with the same in/out process numbers for the same M.O.,
when product shipped and/or received in batches (this can be within up to
three different in/out pairs for each M.O., as found in OPERATIONS and stored
in the table). They are arranged in SORTFL by process no. (i.e., particular
"in" or "out" are grouped together, not necessarily as in/out pairs), so the
searching in JI5 loops must account for this; the primary process is
automatically first for each M.O., because it is smaller than the
subcontractor processes. REPFL has counter to allow for these duplicates
(including the "in" and "out" in key would still not guarantee uniqueness).
** SORTFL scan loops JI53, JI55: first, read the next "in" process (mark
those read to skip them next time), then all the "out" needed to satisfy the
"in" qty, and calculate dates, qty late, etc. from the last one.

40. Create entries for freight using the data in TMPORD. Use product "F" so
that they will be listed together with any real "F" lines.

41. Find first available user number (they must be unique).

42.1. LQ-VIA has 3 digits to allow ending with 999 and entry of via code 99.

42.2. See note 42.1, for LS-VIA.

43.1. Dummy process codes 9001, 9002, 9003 are for the material cost, general
overhead cost, and freight cost; they are higher than all real process codes,
so they are listed in the report at the end. (The process field in REPFL is 4
digits because of these dummy codes.) Also, for general overhead, the hours
total is accumulated in CST-C-HOURS while reading the other processes in the
loop, so it is correct when reaching 9002 in the same loop.

43.2. See note 43.1.

44. To force a blank label, print a dot in position 0,0, font size 1,1 (dot
is invisible). This is needed because, if printing nothing, the Zebra ignores
the label and does not advance the paper.

45. Do not rewrite L-RECORD, fields are used for work only.

46. Allow duplicate order number, in case a blanket order is invoiced twice
the same day.

47. This should never happen, since TRANS duplication is checked earlier,
when assigning the invoice no. in LC and IN (see START TRANS), and users
should not add manually a transaction with an invoice no. in this range.

48. OK-USER should never be blank, but include this condition anyway: those
orders will be included the first time any user prints his orders.

49. SW are the VMS COB$SWITCHES, set in MENU.COM before calling IFOP to
indicate the company, and converted to COBOL switches in WS-DIV (IFAST,
ITOOL, INUT): no switch for Irvine Fasteners (IFAST), SW-1 for Irvine Tools
(ITOOL), SW-2 for Irvine Nuts (INUT), SW-3 when accessing IFOP from mobile
scanners. SW3 implies Irvine Fasteners, and permits just a few, dedicated
functions; these functions assume a scanner with a display of 16 lines x 20
columns, keyboard, and barcode reader.

50. Set QTY-ALPREV=qty, in case the qty changed (there is no check for a
change in qty, all records are updated) to make it the same as after a first
allocation (LB-ALLOC); this is the qty used in the second allocation
(ID-ALLOC-LINE). Set also WEIGHT-ALPREV, just to match the new qty, in case
users inquire into it before the second allocation. If the qty changed,
QTY-AL and WEIGHT-AL may remain invalid until the second allocation, when
they are recalculated anyway. There is no CAN-ALLOC in LG -- it only modifies
qties, since they always use it just before the second allocation.

51. To call: MOVE PH-DRAW TO A-A1 MOVE PH-REV TO A-A2 (or LK-DRAW LK-REV,
etc.). On return, A-A1 has the expanded drawing (adds 2 dashes, so can be up
to 14 characters), and A-A2 has that plus " REV x" at the end (total up to 20
characters). Use A-A1 where display space is limited or where the revision is
not wanted.

52. The PRANGE-xx procedures are called after PR-PAGE, which ends by setting
WS-PR to 3, to prepare for the columns header line that normally follows it.
So must precede these procedures with "MOVE n TO WS-PR" (n = 1 or 2) to
cancel the 3 when the line spacing, in conjunction perhaps with some other
headlines, must be different. The date range procedures (-DATE -DT -MONTH
-MTH) are normally printed in the middle of the page under the main title;
they set WS-PR to 1 internally, so normally there is no need to override
this. The others are printed on the left of the page, so must set WS-PR to 1
or 2 as required. Each range procedure sets WS-PR to 2 at the end, to prepare
for the columns header line; so when calling additional range procedures
consecutively, precede them with "MOVE 1 TO WS-PR" to cancel this.

53. ** Delete records with date earlier than the 01 of the current month, but
if a lot has records >= this date, keep also any older records with that lot,
to avoid leaving partial label history. Indexing is from the most recent
entry backwards within each lot, so LA-ZDATE is <=RL-DATE for the recent
entries. LA-LOT can be used for the comparison, since the file is sorted by
LA-ZLYEAR, which is the same for records with the same lot (the comparison is
for equality only, so the sorting order is irrelevant). ** This operation
also deletes records that were never printed (LA-PR=0). Normally they are
printed within a few days, and if they were not it means that they were not
wanted. This can happen, for example, if printed in FH, where users can
select specific orders. It can also happen if they set C-LABEL for a customer
(to experiment in FC or FH) and labels are then created with picking tickets,
but with an LA-TYPE that cannot be selected in FH. (But now the system marks
as canceled in the daily update any shipping labels not yet printed, so there
should not be any labels of type 2 with LA-PR=0 left from one day to the
next.)

54. IF-RECORD must be in memory when calling AX-EXCH.

55. Must clear PREC if NR-KSV=0, in case it never went beyond LSTEP=1. In
this case the part no., description and "LIFE ..." were placed into PREC but
the line was never "printed"; it is "printed" (i.e., NR-SLINE) only if
LSTEP=2 is reached.

56. ** Create one header SORTFL record for each plant, with date=0 and qty =
MT-QTY-SHIPPED. This record is placed before the real entries and later is
used to display the plant header line. ** There is a separate loop for
DAYREL, and the earlier dates will cause these records to be displayed before
the MATREL records; the plant header record created from MATREL is for both
files. ** BI-OPLANT is initialized as "----", not " ", to allow for MATREL or
DAYREL records with plant=" ". ** No pairs have date=0, but the logic allows
for this: the date is made 9999, otherwise the qty would be added to the
header record. ** If a MATREL record has no pairs at all, or only pairs with
qty 0, it is ignored, and no header record is created either. This guarantees
that there is at least one SORTFL record following the header record for a
given plant -- this is needed for the SORTFL reading to work later (the
header information is displayed on the same line as the following SORTFL
record, which must have a non-zero date). For DAYREL, it is assumed that if
there is a pair with qty>0 then there was at least one MATREL pair, so the
header record was created. ** Pairs with both date and qty 0 are ignored when
creating the SORTFL records.

57. ** Size of S-RANGE-FIELDS and S-PARAM-FIELDS must be the same as
RANGE-FIELDS and PARAM-FIELDS. ** S-A1 S-A2 must be large enough for the
largest field expected (now SS-TITLE, 52).

58. Create a record with the qty already shipped (MT-QTY-SHIPPED is used only
in non-EDI records) as negative (so that it is "added" to KL-TQTY later) and
date 0 (so that it is read first).

59.1. ** Invoice number is unique within each day of the year, but must still
allow for duplicates for the unlikely cases when JF is run twice in the same
day (or JF and JS are run the same day), or if an invoice from the same day
in a previous year is still there. If this happens, all the following WRITE's
in this run will have to increment the invoice number, perhaps several times
(last three digits may go to 999, and then rolls to 000 and increments the
4th digit, in effect making it the number of the next day); this may slow
down the operation considerably if there are many such invoices, but there is
no other way with 6 digits to ensure uniqueness for all cases. ** Irvine Nuts
uses invoice numbers in this range, so the generated invoices must start with
a 9 and can increment only up to 99 before rolling into the next day.

59.2. See note 59.1.

60. Use START/READ NEXT (not just READ) to read back the original product
record after reading the nut record, so that the COST-CALC procedure can also
be called in a loop scanning the PRODUCT file.

61. MR-HEAT, MR-LOT, MR-NOTE, MR-END, MR-LINE, MR-PAGE are used in MR and IT.
P-RECORD, LT-RECORD, HE-RECORD, etc. (depending on procedure) must be in
memory before call.

62. ** For Epson dot-matrix printers: VMS adds X"0A0D" following each
DOC-LINE, so one line is advanced on the new page after the X"FF", resulting
in effect in only 65 lines per form. When initializing the printer, DOC-LINE
must be executed to send the initialization codes; a line is advanced after
the codes, so the print position is undefined; the local XX-PAGE must
therefore always advance to a new page, even for the first page after opening
the print file, to ensure that all pages start at the same line (unlike
PR-PAGE, which assumes the paper is positioned at top of form and does not
advance for the first page). At the end, a line is skipped when re-sending
the initialization code, so if also sending X"FF", if VMS does not start a
new page when closing or reopening the print file, the print position will be
one line too low for the next print job on that printer (in consecutive jobs,
when the operator does not advance manually to the next page). ** For laser
printers: LAS-DOCLINE invokes DOC-LINE, but only the start-up initialization
issue applies.

63. RD12 screen with field markers:

^PRODUCT RECORD  ]          ^PRODUCT NO.] ............       (NUT: ............)
                                          ................................
^ALTERNATES] ...                          ................................
^GENERIC PRODUCT] ............            ................................
^QUOTE REF] ..........                    ................................
^INACTV, CUST, ORDER] .  ...... ......    ................................
^OPER.] ........................................................................
        ........................................................................
^PLTG, SPEC] ...  .................... ^CATEGORY, FAMILY, MARKET] ..  ..  ..
^DIAMETER,GRADE] ..... .....           ^WEIGHT NET,GRS,P] ...:..  ...:..  ...:..
^WIRE,PROCESS,CLEANING] .:....  .  .   ^PRICE 1,2, MODE ] ....:...  ....:...   .
^MACHINE,RATE,ALT MAC] ..   ....   ..  ^COST, CHG PRICE ] ....:...   .
^PACKING,QTY,CONTAINER] ..  .... .
^TICKET COLOUR, PPAP] .. .             ^ON HAND, Q BINS ]...,...,... ..,...,...
^HARMONY] ..                           ^DEMAND          ]...,...,...
^QTY LST YR, 2 YRS AGO] ...,...,...    ^FUTURE DEMAND   ]...,...,...
                        ...,...,...    ^ORDER, TMP ORDER]...,...,... ..,...,...
         ^   MTD  ]   ^   YTD  ]       ^IN PROCESS, DM  ]...,...,... ..,...,...
^QTY   ]...,...,...  ...,...,...       ^R.O.P.          ]...,...,...
^WEIGHT]...,...,...  ...,...,...       ^R.O.P. EST, LVL ]...,...,... ...
^AMOUNT]....,...:..  ....,...:..       ^BANK,LEAD W.DAYS]...,...,... ...
                                       ^LAST NET, GROSS ] ../../..  ../../..
NEXT PRODUCT ____________              ^LAST RCVD, NEW  ] ../../..  ../../.. .
??

64. ** Find P.O.s for current PH-NO that are late (required date is system
date or earlier) -- used in tools and material run-out reports. If not late,
set LK-DATE-TMPREQ equal to LK-DATE-REQ, otherwise set it equal to that of
the first following P.O. that is not late; if none, set it 70 days past
system date. For materials, if earlier, use A-N1 (the first mill cycle date,
calculated before call and also used in the report). ** LK-KP can have
duplicates, so when returning to the current record to set LK-DATE-TMPREQ,
after looking ahead, must have a READ NEXT loop checking that this field is
still 0 (this is why the field must be cleared first in all records of that
PH-NO); this is the only way to avoid an infinite loop between two duplicate
records when the current record is the second one, since the saved key
returns then to the first record, not the current one. There is no need for
INVALID/END here, since the record was already read -- it just may not be the
first one read after START. ** In reports, PURLIN is still read through
LK-KP, in LK-DATE-REQ order, but LK-DATE-TMPREQ is used for run-out
calculations; it may be different from LK-DATE-REQ, but is still in ascending
order.

65.1. Prepare to print underline under the "M": BAR-UDX points to spot after
the "M", and ^FT...GB0 prints the line from there. (Cannot use ^FO, which is
normally used for lines, and which would require to point to spot before the
"M" and print the line down, not up, because only ^FT allows positioning
after the previous text by omitting the Y coordinate.)

65.2. The specs in the two lines for DESC-A and DESC-B must be identical in
the part IF BAR-UDX>0, which "overprints" them up to BAR-UDX. See note 65.1.
But there is no need for this logic when printing DESC-B below DESC-A (when
printing NOTE-1 in the space of DESC-B), because BAR-UDX is then always 0.

66. SORTFL is required because several bolt records may point to the same
nut.

67.1. If 25% or less is missing, do not consider this order as run-out:
assume entire order can be filled (clear total), and if the shortage was
triggered by a P.O. with a date too late (KPUR=1) rather than by not enough
P.O.s, use START to reposition on the same P.O. (in this case its qty was not
added to total) so that the next READ NEXT will read it again (LSTEP remains
1).

67.2. See note 67.1.

68. ** In JJ-CL and JJ-CR, customer total can be <0 in MATREL reports when
MT-QTY-SHIP is larger than the sum of the other REPFL records; one record was
added earlier with MT-QTY-SHIP negative and date-reqd = 999999, so this qty
is added to the total column (but not to an aged column) in all subtotal
levels. When negative, the customer subtotals are set to 0 (since a negative
value is meaningless as outstanding orders), but then we must also correct
the total in the salesman and grand subtotals. ** In JJ-CL do not print the
totals line when the customer total is 0. The customer number and name are
placed in PREC in JJ-CUS when a new one is encountered, and is printed only
later with the first order line, so nothing is printed if the total is 0.

69. For overseas customers deduct the freight, which is included in the line
amount as $5.25/100 lbs.

70. See notes for this label in labels info file. The program calculates the
text start position in order to center the text in the label width of 165 mm.
The table entries match LIT-ALPHA (A - H); last entry is for space. The table
entries must be modified if modifying the font width.

71. For OP=3,4: sorted by sales rep, totals are printed at the end of each
rep, so SORTFL is opened and closed for each rep; WS-PAGE, RM-STEP, and
TOT-IND must be restored for each rep (TOT-IND is reset in RM-T); must call
PR-PAGE only after reading the first record, because the type (RM-OREP)
appears in the heading. Initialize RM-OREP with a value other than " ", to
cope with records with blank MT-REP.

72. Product total is the qty in record with SR-F22=0 (record type) and
SR-F23=0 (date), so it is the first record read for each product. Normal
records have record type=1. MT-QTY-SHIP is in record with record type=1 and
date=0, so it is listed before any other normal record; it is recognized by
qty<0.

73.1. ** AUTO-CODE values must be the same as ED-TYPE; when changing, update
also in RD302 (specs screen of RO report, where the codes are shown as user
help -- this also serves as documentation of actual customer names). ** AOS
is Tower Automotive (previously A.O.Smith); do not confuse with Tower Group
International (customs broker, not automotive customer, no entry in ED-TYPE).

73.2. See note 73.1.

74. Last line is 21 rather than the usual 22 in order to accommodate 2
display lines for each order line in subcontractor orders. This wastes one
line for the regular orders, but it is much simpler than checking for the
last line separately and also allowing for possibility of regular lines in a
subcontractor order. (Few orders require more than one page anyway.)

75.1. ** For each M.O. entered, print first the drawing (one or two pages)
and then create the PCC form (process control card). The M.O and IFxxxx
numbers are printed on the first drawing page, before printing the drawing.
** Page 2, if it exists for a drawing, is automatically included following
page 1, by including all records with the same drawing no. in key; the page 1
and 2 header records are skipped by skipping records with line 0. ** Checks
first whether drawing exists; if not, only the IFxxxx and M.O.s will be on
the page, and the PCL job-end codes are sent; if it exists, it flushes the
current print file record (to simplify the read-write of the PDRAWING records
into the print file, both being 512 bytes) -- in this case the job-end codes
are included in the drawing records (in each page; page 2, if any, starts a
new print job). The job-start codes that are part of the page 1 drawing are
cleared, since they are sent with PCL-INIT.

75.2. See note 75.1.

76. Do not use SET-SHORT-SCHED in sections that use OPEN-MACSHED, since it
itself includes it.

77. For Chrysler only, modify the first pair on or after the system date, to
reflect the difference between the authorized cumulative qty and the actual
one (if overshipped, reduce the pair qty, else increase it).

78. P-CAT=80 means quotation products, similar to CST-KQ=1.

79. ** Perform after SALSUM month 12 file update: RL-CHK checks that all five
years in SALSUM are zero in order to delete a product, and this must be done
after shifting the years (so in fact only the last four years are
considered). If doing before SALSUM update, must check only years 1 - 4 in
SALSUM table, since year 5 will be shifted out. ** In RL-DEL, A-A1=" " for a
generic product that has no alternates; ="G" for a generic product that has
alternates (and thus all its alternates were deleted, otherwise the generic
product is not deleted); ="A" for an alternate product. ** In RL-DEL only the
loop for SALHIST and SALSUM checks for 100 deletions; in the other files
there can be only a few records for each product, so the check is done only
at the end of the loop. ** In RL886 allow for error case where P-GEN = P-NO;
deleting that alternate will upset the generic read sequence and the START
will cause INVALID KEY; in this case reset the reading to PRO-NSV.

80. ** LK-CAT is moved to PH-CAT for use in PART-TYPE, because PH-RECORD is
not read at this point. ** KPRICE-CALC is needed only to create the discount
description string, so the calculation of CL-AMT from qty, price, mode is
irrelevant.

81.1. Calculate number of actual notes lines and total number of pages (by
calculating the maximum number of product lines per page): LNP is the number
of printed lines per product (one extra, blank line for Mexico, but this is
old logic, no longer needed, and users never enter FO-STATE = "MX" in IN; if
important, change logic to IF FO-CUS = "06106", as for MSG-M3), LN1 and LN2
are the first and last usable lines, LNN is the last usable line on the last
page (= LN2 - (1 blank line before notes) - (number of notes lines)).
Condition WN2<=0 checks if product lines + notes fit on one page. The page
calculation does not take into account any nut lines (which add 2 lines to
their product lines), so it may be too low for invoices with nuts.

81.2. See note 81.1, but here there is only a fixed 2-line note at the end;
the 2 lines for cartons/skids/pads printed at the end, if present, are
treated as one extra product, not part of the notes logic (each product also
needs 2 lines, and there can be either cartons/skids or pads, not both).

82. ** The loop LG63 searches for lines with a qty that could not be reduced
in the earlier logic (stored in HL-QTY-DIFF, and then HO-IND is known to be
>=3), or will not be deleted in the following logic (HL-USE=0, but
HO-IND>=3), and subtracts it from the extensions following it. (Ignoring
HO-IND>=4 was added Aug 2005, so this leaves only 3; see note 99.) If any qty
is left unsubtracted, it is ignored -- an exception code could be generated
for this, but this is highly unlikely to occur, since there should exist
extensions for 2 weeks following the system date. Lines earlier than the
system date are ignored: the subtraction logic must not be applied to them.
LG-DATE-MOD will show the latest date of an extension that was modified by
the system, and is used in LG-P to include these extensions in the "new"
list. Must reduce HL-QTY-NEW too by the same qty, to make it negative (it is
0 originally), so that in future calculations the qty subtracted here is
added (this negative value also is used to tell between a record modified and
one added by the program because of a qty discrepancy). ** The loop LG673
deletes lines that were not used in all the previous logic; if no lines are
left, the extension itself is deleted. (Now all blanket orders have only one
line.)

83. D-WKDAY returns (in A-N1) the week day of D-DATE (1=Monday). D-OFFDAY
returns (in A-N1) a code for D-DATE: 0=working day; 1=weekend day; 2=day off
other than weekend, according to the days-off table. D-PDAYS returns (in
A-N1) the number of production days in month D-MM in year D-YY.

84. Date procedures: ** Dates are treated as numeric date values (number of
days since an arbitrary past date), but are entered and displayed/printed as
MMDDYY, YYMMDD, etc. The numeric date values are based on: Dec 31 1869 = 0,
Dec 31 1969 = 36524, Dec 31 2069 = 73049 (36524 + 36525). ** D-LEAP (leap
years) assumes dates in range 1901 - 2099. ** Current date range window when
using 2-digit year D-YY (in ACCEPT, etc.): 19xx for YY = 70 to 99, 20xx for
YY = 00 to 69. Procedures like D-MN and D-NM handle only dates in range Jan 1
1970 - Dec 31 2069. ** D-MN converts from MMDDYY to numeric date; D-NM
converts from numeric date to MMDDYY. In D-NM, D-LNUM (D-TBL4) is needed only
to speed up the year calculation (finds first one of 5 20-year periods, then
the actual year within the period).

85.1. IFPURORD, IFPURLIN, IFPART, IFTOOLS, IFTOOLPROD are the files of
Irvine Fasteners, so they must be identical to PURORD, PURLIN, PART, TOOLS,
TOOLPROD. They are needed when accessing these files while in the Irvine
Tools directory.

85.2. See note 85.1.

85.3. See note 85.1.

85.4. See note 85.1.

85.5. See note 85.1.

86.1. When changing PURORD/PURLIN fields: in TMPURORD/TMPURLIN,
YOK-DATA/YLK-DATA must be large enough to contain all the used bytes of
OK-RECORD/LK-RECORD (i.e. space without the FILLER at the end), since the
entire record is moved into that field.

86.2. See note 86.1.

87.1. ** Delete all the records with the same plant-product, but only if
earlier than the current EDI file (or the same -- to allow for case where
users read the same file a second time, if the first time it was invalid,
incomplete, etc.). At the end, if there were any records left undeleted
(i.e., there was at least one later than the EDI file), ignore the current
EDI data. Normally, there should be only one record with the same
plant-product in the file, so this loop is only executed once. But must allow
for multiple records (this is the purpose of DY-SEQ); for example, each
record contains pairs for different dates, perhaps just one pair/record. When
adding a new DAYREL record, SEQ is 0, but if this record exists it is
incremented until an unused one is found; it is important to delete old
records in those cases where SEQ is used, so that there are always free
SEQ's. ** A-N1 is normally set to 0 before calling DAY-DELREC. Delphi and
Saturn may have more than one DELJIT record active -- their orders do not
replace previous ones, so do not delete the old ones. For them, the system
will create DAYREL records by increasing SEQ in the key. A-N1 is set
arbitrarily to 30 days to keep the 2 or 3 most recent. AmAx repeats DELJIT's
from several prior days, and also sends several DELJIT's for the same
plant-product for the current day, so cannot delete an existing today's
DAYREL; add to its date-qty table rather than creating additional ones with
higher SEQ's; A-N1 is set to 1, to delete previous day's record, and the
DELJIT's are treated differently in IP. ** DAY-ADDREC: even when there are
several SEQ's, there should never be more than a few, because DAY-DELREC
keeps only the latest few; their SEQ would normally be low, but some values
may be missing, including 0. So, either only 0 is used, or a few low values
are being reused. A-N1 counts to 99 in case something went wrong and there
are 99 SEQ's, to avoid an infinite loop. EN (DAYREL maintenance) has
provision for SEQ, but MA (MATREL maintenance) does not. (Jan 2007: there are
no SEQ's >0 in either DAYREL or MATREL.)

87.2. Logic similar to DAYREL, see note 87.1.

87.3. KSR uses sometimes two LIN sections with the same product. The second
section (which seems to follow immediately after the first one) is for
distant future periods (with "planned" rather than "firm" indicator in the
FST entries). That section is printed here just like a separate product line,
but no record is added to MATREL; instead, the FST entries are added to the
the end of the record previously created for the first section. Without this
logic, MAT-DELREC would delete in the second LIN section the MATREL record
created in the first section. (An alternative would be to create a second
MATREL record, with MT-SEQ=1; but this still requires preventing the deletion
of the first one, and some operations in the system can access only SEQ=0,
e.g. MA.) The only way to be sure this is indeed a second section is with
MT-RUN-KEY (used only for this purpose): this is the date-time of the current
830 run, and if the same as in the MATREL record it means the record was
added in this run, so this is the second LIN section. This logic must not
interfere with the MAT-DELREC logic, which must still delete a MATREL record
added in an earlier run the same day, in addition to deleting records from
previous days and/or with previous ISA numbers.

88. PRICE-CALC is called either directly or from LPRICE-CALC or KPRICE-CALC.
Must set before call: CL-QTY, CL-PRICE, CL-MODE, CL-DISC; and, if calling
PLATING-CALC after PRICE-CALC, also CL-WEIGHT (total weight, as calculated by
WEIGHT-CALC).

89. Add R-NO to REPFL key to make it unique, since for orders of bolt/nut
combinations two M.O.s have the same R-SPORD and R-SPLIN (one for bolts, the
other for nuts), and this would cause duplicate REPFL records.

90. COST-E may be called both from COST-CALC and from other places (where
errors are added to the same table, e.g. AI) before or after COST-CALC, so
CST-IXE must be set to 0 outside COST-CALC.

Costing calculation error codes:

MM: general - machine record not found
TT: general - tools record not found
OO: general - operations record not found
MP: material - part record not found
TM: third party - process record not found
TX: third party - more than 5 processes
PM: conversion - process record not found
PX: conversion - more than 10 processes
PO: conversion - missing machine type for overhead
PT: conversion - tool record not found
PK: conversion - packing record not found
PP: conversion - packing part record not found
NN: bolt+nut - nut record not found
NM: bolt+nut - wrong machine in nut record

91. ** Before call must read PRODUCT and OPERATIONS. And must set: CST-PRICE,
CST-PACKING from the alternate if the alternate was entered (applies only to
JM), else from the generic; CST-MAC; CST-NUT from the alternate P-NUT if the
alternate was entered and a nut is found there, else from the generic (same
logic as in the rest of the system, to allow for both Victaulic-type
products, where the nut is in the alternate, and for the others, where the
nut is in the generic); CST-KPRI (1 if price entered (applies only to JM)
else 0); CST-KQ (1 if called for quote product, else 0); CST-IXE (0, returns
number of errors found); CST-LOP (last operation to include, -1 for all
operations). And if calling COST-DISP following COST-CALC, must also set:
PRO-DESC fields (call DESC-RTN) from alternate or generic, same logic as for
CST-PRICE, etc.; CST-ALT if the alternate was specified (applies only to JM),
else blank. ** See also note 90.

92. Before calling TL-DISP-TOOLS: PERFORM WRT132, PERFORM TL-SET-TYPE. After
call: erase screen from line 8 down. The tool no. displayed is TL-IXF, not
the TS-TOOL field number. Only 80 fields fit on the screen (5 columns x 16
lines) and there is no check that this is exceeded, so no page should have
more than 80 tools.

93. ** PH-LIFE is per thousand, but do not convert it, since the tool cost is
also calculated per thousand product pieces. ** For mode 3, set tool cost as
only 80% of laid-down cost, to compensate for the inaccurate tool life
values. This should be removed if changing to life calculated from tools
purchased and parts made.

94. ** These multipliers are "tons/1000 pcs" (CST-GMULT for gross weight,
CST-NMULT for net weight). They are used to convert "cost/ton" (the value in
M-COST, OP-COST when CMODE is G or N, and also the price for materials in
PH-LDCOST, LK-PRICE, PU-LDCOST) to "cost/1000 pcs" (by multiplying by
CST-GMULT or CST-NMULT) or vice versa (by dividing). ** For Irvine Tools they
are meaningless: in some calculations they are not used at all (calculations
bypassed, or results cleared) so their value is irrelevant; where their value
is meaningful (material (laid-down cost is /lb, P-GROSS is /100 pcs),
conversion (labour is 0, overhead is cost/hour x hours/piece), general
overhead (cost/hour x total hours/piece)) the calculation is performed
differently anyway (the final price must be "per piece", as opposed to "per
1000 pcs" in Irvine Fasteners). ** These procedures are used in COST-CALC and
also directly in other places (e.g. FE); before calling COST-MULT-INIT,
P-RECORD must be read, and CST-MAC must be set. COST-M is used to set
CST-MULT depending on the current CMODE; but CST-GMULT and CST-NMULT can also
be used directly, when there is no CMODE to decide which one is needed.

95. ** See KM, where Irvine Tools M.O.s are generated by the system: the M.O.
no. is the same as the P.O. no., and for assemblies there are several
additional M.O.s, for the component tools, with same M.O. and suffix 1, 2,
etc. ** All orders have only one line, so there is no IFPURLIN loop. Other
operations allow for multiple lines (although this is never used), but here
there is no point in allowing this, since if the M.O. has the same number as
the P.O. there cannot be different parts with the same M.O. no.

96. PH-RECORD must be in memory at this point, since PART-TYPE needs PH-CAT
and DIV-PAMT needs PH-MODE. If the part was not found, PH-CAT and PH-MODE are
set from the PU fields.

97.1. Restore previous sequence no. (IF-ORDNO, IF-BLNO, etc.) in INFOFL only
if no other user performed this operation, or another operation that
increases the same sequence no., after the sequence no. was increased a few
lines back. Such an access would have increased it again. So, if the sequence
number is no longer as it is in IF, it means it was increased elsewhere, so
it cannot be restored, and that particular value will simply remain unused.
(Another way to do this is by first reading INFOFL and displaying the next
number without incrementing it, and when approved reading it again,
incrementing, and displaying it again.)

97.2. See note 97.1.

97.3. See note 97.1.

98.1. LIT-LOGFL (file IFOPSUBPROC.LOG) is the "output file" parameter, and is
created by VMS every time LIB$SPAWN is invoked. An "output file" is needed
only to prevent message lines (like "LAS01.PRN STARTED ...") from being sent
to the terminal, which is the default for "output file". There seems to be no
option in LIB$SPAWN to prevent this. Such a message would shift the current
screen up one line before being displayed on the bottom line.

98.2. IFOPSUBPROC.LOG is created when executing AUTO-PRINT (about 100 times
per day) and for all other LIB$SPAWN commands. It is deleted here to prevent
the version number from advancing up to the maximum of 32767 (which would be
reached in less than a year), where VMS cannot create a new version and would
not execute LIB$SPAWN.

98.3. See note 98.1. Use LIT-LOGFL because there may be VMS messages for COPY
command errors (file locked by another user, etc.).

99. ** There may be several product lines per order, but only those required
in that day's extension are copied from SAORD into SHIPORD. ** HO-TPLANT is
used as indicator that the order extension was referenced from DAYREL (also
needed for the plant value for the "D" entries in the exception report).
HO-TPLANT is set for all extensions before scanning the pairs, because when
canceling an order there may be no pairs at all in DAYREL that day and hence
no SHIPLIN lines at all will be read. ** HL-USE is the indicator that the
line was referenced, and if its qty is not 0 it is deleted (but if status>=3
it is an "F" exception). ** Ignoring orders with status>=4 was added Aug
2005, to cope with orders left overnight at status 4 or 5, i.e. shipped but
not invoiced; the qty in these orders must be ignored in these calculations.

Exception codes:

'C' - an extension was created from a DAYREL pair with a Sunday date that is
earlier than today.
'B' - an extension could not be created from a DAYREL pair because its date
is earlier than today (and is not a Sunday date).
'A' - there is a DAYREL pair for today, but there is no extension for today,
so one was created.
'S' - an extension was found for that date, but the qty is different from the
respective DAYREL pair and the order could not be modified because its status
is 3 or more (the qty shown is the difference: DAYREL - extension); an
extension was created for that day, or a later extension was modified.
'E' - an extension was found for that date, but it has no line with this
product; this line should have been added to the order, but could not be
added because its status is 3 or more.
'D' - the extension is not required according to the DAYREL pairs, and
because its status was 2 or less it was deleted.
'F' - the extension is not required according to the DAYREL pairs, so it
should have been deleted, but could not be deleted because its status is 3 or
more.
'G' - the extension is for today and is not required according to the DAYREL
pairs, so it should have been deleted, but because it is from certain
designated plants it was not deleted.

100. ** YOK-SEQ is needed to allow several YOK records for the same order (no
need to check YLK-SEQ -- it is simply made the same as YOK-SEQ). Blanket
orders, for example, can generate any number of YOK orders, since the same
order is used every time. (Although TMPURORD/LIN are reduced in RL, the same
order may still be in the file.) ** TMPURORD/LIN are used only to print the
dummy invoices, and each TMPURORD record has only the TMPURLIN lines that
were invoiced in that run, not all original ones.

101. BAR-LAB-AMAX currently is never called through BAR-LAB-SHIP, since it is
only called directly, in places where only AmAx labels are created, so the
case C-LABEL=3 never occurs.

102. To allow for possible rounding error, add arbitrarily the difference to
the first line: the sum of the calculated distributed freights must be
exactly equal to AT-FREIGHT. For the distribution of the exchange G/L
entries, it is done differently (adding up the individual amounts and adding
the total exchange G/L credit entry at the end of the loop), because there is
no previous total exchange value that needs to be matched.

103. Allow for invalid PART record (nonexistent part used in orders only):
PART-TYPE reads PH-CAT (for ADJ-LQTY, so 0 is OK). No other PH- fields are
needed, and PURLIN fields can be modified as usual.

104. Report includes only orders with open line(s), so can stop reading
PURLIN when the first open line is found. If none are found, the order is
ignored.

105.1. The purpose of the machine and tool logic is to represent a large
number of machines with a relatively small number of tool tables and display
screens (possible thanks to the machines' similarities). ** Each entry in
these tables matches the fields in TL-DATA: tool description, entry no. in
tool record TS-TOOL table; station no., category, location (see definitions
below); page no., row, column (in the RDxx display screen); mandatory and
setup indicators. When there are several sets of fields per entry, the fields
before page no. are common to all, the sets are separated by underlines, the
first set is used as work area, and the current set is copied to it from
TL-TINF. ** The number of entries in TL-BTABLE, TL-NTABLE, etc., must match
the values in the fields following each table (TL-BTBL and TL-BTOOLS for
TL-BTABLE, TL-NTBL and TL-NTOOLS for TL-NTABLE, etc.). When changes are
needed, only these tables, values, and the RDxx screens need to be modified
(no changes in logic are required). ** The order of entries in the tool
tables is not related to the value of TL-FLD, which is their order in the
TS-TOOL table. But the order is important in other ways, as follows: The
row/column values must be in increasing order, reading top to bottom, left to
right. This is used in two ways: it decides the order in which fields are
ACCEPT'ed in TM (tool file maintenance); and (as in TC-F) it decides when to
end a line, by checking if ROW>IXT. The order in the tool tables is also the
order in which the tools are scanned and shown in sections like TN, TQ, TJ,
which is not critical, but should be the same as the order in the screens.
There is some flexibility in tables shared by several types: a tool can be
further to the right on the screen in one type, as long as the row/column
values are in increasing order for both types; this allows the insertion of
tools used by only one type, between tools used by both, in a logical place
in the table and in the screen. Similarly, entire lines with tools used by
only one type can be inserted; this will increase the line number for all the
following tools on that page in this type, relative to the other type. Also,
blocks of lines can be moved to the following page, increasing both the page
and the line. ** When adding a new machine, modify the information table
below, the TL-xx procedures and tables, TC "create tool forms", NE "tool
tables listing". The machine type is only used in TC, NE; for new machine
identical to existing ones, add to various descriptions in procedures and in
TC, NE; if only similar, extend a TL-xx tool table by adding a TL-TINF
section and/or tool entries, and add new RDxx screen B, C, etc. similar to A;
if very different, create new RDxx and new TL-xx tool table. See also the
notes in FD TOOLS.

Mapping of TL-TYPE to display screen, tool table, machine type, machine
numbers:

TL-TYPE      Tool    TL-TINF  Machine  Machine
    RD scrn  table            type     numbers
--  -------  ------  -------  -------  ------------
 0  RD801X   BTABLE     -       0      - (generic, when no machine given)
 1  RD801A   BTABLE     1       7      3,7
 2  RD801B   BTABLE     2       8      1,2,4-6
 3  RD801C   BTABLE     3       9      17,20
 4  RD801D   BTABLE     4       9      18,19
 5  RD801E   BTABLE     5      11      9-12,15,16,22,23,25-27
 6  -
 7  -
 8  RD802    NTABLE     -      18      29-31 (nuts)
 9  RD804    STABLE     -       -      54 (outside made bolts)
10  RD805    PTABLE     -       -      99 (purchased bolts)
11  RD803A   XTABLE     -      12      24
12  RD803B   XTABLE     1      12      36,38
13  RD803C   XTABLE     2      12      32-34
14  RD803D   XTABLE     3      12      37
15  RD803E   XTABLE     4      12      39
16  RD806A   YTABLE     -      10      21
17  -

TL-STN (station no. in machine): 1 - 6, or 0 if tool not used in a station

TL-CAT codes (category: assembly type or tool that is part of assembly):
1 ASSEMBLED DIE
2 ASSEMBLED PUNCH
3 ASSEMBLED PIN
6 DIE TOOL
7 PUNCH TOOL

TL-LOC codes (location: case and type/group of inserts):
1 DIE CASE, PUNCH CASE
2 FRONT INSERT, FRONT INSERT 1, PUNCH INSERT 1, PUNCH FRONT INSERT
3 FRONT INSERT 2, MIDDLE INSERT, MIDDLE INSERT 1
4 BACK INSERT, BACK INSERT 1, PUNCH BACK INSERT
5 PUNCH INSERT 2
6 MIDDLE INSERT 2, MIDDLE INSERT 3
7 BACK INSERT 2, BACK INSERT 3

105.2. TL-FIND-TYPE, TL-SET-TYPE, TL-SET-TBL, TL-SET-SCRN, TL-RD-SCRN: see
note 105.1.

106.1. ** LK-CAT is moved to PH-CAT for use in PART-TYPE, because PH-RECORD
is not read at this point. If LK-CAT=0 (an invalid part in order entry),
PART-TYPE will leave the tool/mat indicator 0, which is OK -- it is the
users' responsibility to have valid parts when they must be identified with
PART-MAT in this section. ** LK-GL is recalculated here in case LK-CAT or
LK-MTYPE changed (they are checked and updated in BN from the PART fields).
But if the part does not exist (LK-CAT=0), do not recalculate LK-GL (it was
entered in OM manually). In both cases, the user can modify LK-GL here (in
IG55), and it is checked again. Could recalculate it in BN, but it is
time-consuming (would have to read TABLES and also the PURORD and VENDOR
records). LK-GL is not needed anywhere before this point, and here it is a
good place to set it: it is used later in IG6 (where adding amounts by
LK-GL), all PURLIN lines are read anyway, all the necessary fields are
already read, and LK-RECORD is rewritten anyway.

106.2. See note 106.1; set PH-CAT for PART-TYPE. If category 801 (purchased
goods) PART no. is the same as PRODUCT no.: GL-QTY must be entered as weight,
so convert GRT-QTY into lbs (using P-WEIGHT). We assume that if several LK
lines have the same G/L account, and thus are merged into the same table
entry, they also have category 801 or not 801, so we add qty to qty, weight
to weight.

106.3. See note 106.1; here both LK-CAT and LK-MODE are moved to PH for use
in PART-TYPE and RES-PMODE. For invalid parts, LK-CAT is 0, but LK-MODE can
be set in order entry.

107.1. ** RD801X, RD801A1 - RD806A3 are used in TM and TC, but only
TL-RD-SCRN reads them; so all conditions (e.g. line range TL-R1/R2) are
specified in only one place. ** These screens must have the first 2 lines
identical, because one may be overwritten by another in TM when the product
changes from one type to another; the product number is then re-displayed
where previously entered by the user. ** See also note 105.1.

107.2. See note 107.1.

108. Display line range 10 - 22: up to 13 lines are displayed with 14
suffixes per line (total 182).

109. ** Call TL-TP-UPDATE with A-N1=0 to delete TOOLPROD references, or
A-N1=1 to modify them. TS-RECORD must contain the new tool list (or list to
delete if A-N1=0) and TL-LREC the old one. Must set TL-NUM before call. **
The INVALID CONTINUE are not actually necessary for WRITE and DELETE, since
the records in TOOLPROD are unique: uniqueness is ensured by TP-MAC (when the
same tool and product are used in several tool lists) and by TP-FLD (when the
same tool is used more than once in the same tool list). This also applies to
all other places where TOOLPROD is updated (where there are no notes). **
Closing and opening TOOLPROD at the end is the standard precaution (the RMS
delete problem), in case many of the deleted records are consecutive.

110.1. ** TY-TSREC must be the same size as TS-RECORD. ** TL-LREC layout must
be identical to TS-RECORD (only the tool fields are used now, but allow for
entire record). The constants TL-BTOOLS, etc. and the corresponding table
sizes TL-BTABLE, etc. are the actual number of tools used in TS-RECORD,
depending on TL-TYPE (see "Mapping of TL-TYPE" under note 105.1). Change
these values if changing the number of tools used. There must be no "gaps"
(unused tools in the middle of the TS-TOOL table), but any tools may be
unused for any one machine within a machine group; then the values are
"0.00.000.00" in the table and that tool is " " in TS-TOOL. (When deleting a
tool, clear it like this in the table and in TS-TOOL -- scan TOOLS looking
for all records with that machine). ** To see if a tool is used, operations
that scan the TL-xx table check for "page not=0", and operations that scan
the TS-TOOL table check for "tool not=' '" (rather than going from the tool
number to the TL-xx table). When creating a new tool list, the entire TS-TOOL
table is initialized with " ", so when adding a new tool at the end there is
no need to clear it. ** The fields in the TL-xx tables are in the same order
as their order in the TM screens. For new screens, create the screen first
and from it the field rows/columns in the table.

110.2. See note 110.1.

110.3. See note 110.1.

111. Perform TL-SET-TYPE before reading TOOLS (normally done after), so that
TL-TYPE and TL-NUM are set for both the valid and invalid cases; only TS-MAC
is needed for this, and it has the correct value at this point.

112. PART-TYPE must be executed before calling RD-CATGL (see PART-MAT).

113. Special records added to REPFL for the total of company contribution
(the sum of codes 280, 281, 285, 286, 287), and company pension contribution
(code 283) and its credit equivalent. They must be added to REPFL in order to
sort them by G/L account when listing it. These are the only G/L accounts
specified directly here: company contribution: 235805 049 06 0000000 (div.
30, 40, 50), 543105 077 05 0000000 (div. 35, 45); company pension
contribution: 543104 077 05 0000000 (credit), 133545 000 00 0000000 (debit).
They are only needed for the G/L export file -- all the others are taken from
GLDIST, using the payroll codes and LDTBL to find and convert them. The
arbitrary strings "CTOT", "DPTOT", "CPTOT" are placed instead of LY-KEY in
REPFL and are used when reading REPFL to identify these special records. Only
the amount is needed then, so only LY-AMT is set in LY-RECORD, as debit, to
balance the entries themselves.

114. ** GRT-PROC is called from IG, AG, IH but AT-QTY are used only in IG; in
others they are 0, but the logic here is the same for all (in GRT-P5, GRT-QTY
will simply be 0). GRT-TRANS (the only place where GRT-QTY is used) is called
from GRT procedures, so GRT-QTY must be set to the correct value before
calling GRT-TRANS (i.e., set to 0 when not used). AT-QTY are currently used
only for these calculations. ** V-RECORD must be in memory when calling
GRT-PROC and GRT-CHQ (see the V- fields).

115. ** Print all five WS-DESC fields, do not stop at first blank one as is
normally done; this way the tools printout will start on the same line for
all products. ** Print first the original screen line, then the line plus the
tool numbers after advancing 0 lines. This way, the tool titles are
overprinted, so they become "bold" print. The underlines (field markers) are
printed the first time; in the second printing, the tool numbers replace the
underlines (with blanks when the tool is blank). Thus, the underlines (which
are shown in all tool positions, blank or not) and the tool numbers are in
"normal" print.

116. For TM-OP=1 ("add") TS-RECORD copied to TL-REC is all spaces, i.e., all
tools are " "; also, TM-OP is set to 2 ("change") later. Thus, in TM-A, tools
that are added will be updated, since they are compared with " " and hence
are different from previous value (similar to "change"). Also, TM-KFIN is set
to 1 ("exists"), to cope with a page change when TM-OP=1 originally: it will
pass a second time through this logic, and must force the "duplicate" message
if TM-OP=1 again (must be 2).

117. Print weeks with 0 totals only when they are between the other weeks. Do
not print if week 1 (past due) or beyond the last week with non-zero totals.
If week 1 is not printed, show all the others as week no. - 1, so that the
count starts from 1 not 2. Always print week 20: it is initialized with dummy
date 12/31/2069, to get all due dates set by users with dummy distant dates
(for unknown due dates).

118. ** Do not check for LK-QTY-REC >= LK-QTY: allow for the case where
someone increases manually in SUBCON the qty sent out, so they have to accept
in returns more than was originally sent. Without this, the system would
never find the line, would show the dummy invoice with a header and a blank
line, and would leave that qty unprocessed in A/P while processing it in the
subcontractor logic. ** Recalculate the price and mode in case they were
modified since the SJ record was created; the logic is the same as in GS
(where the SJ fields are created) and GR (where the LK fields are created).

119.1. ** Increment UD-IX counter before placing the drawing values into the
print field, not after, so that it can also be used later throughout the
operations for this drawing cycle, to add the "*" for errors. ** In the input
file, all page-1 come first, then all page-2. Here both old page-1 and page-2
are deleted when encountering page-1 in the input file, and only page-2 is
deleted when encountering page-2. So normally there will be nothing to delete
when page-2 is encountered, but this allows the sending of a page-2 alone.
When encountering page-2 it checks for the existence of page-1 in DRAWINGS
and if not found it skips page-2, to avoid having a page-2 without a page-1.

119.2. See note 119.1.

120. Only TRF and PRO here: MNT can only be used with tools, and the previous
condition checked for materials.

121. TN-DF is same size as XM-F5 and TH103/TH104.

122.1. Unlike typical "more/end" type inquiries, here it must allow an
invalid PART record (TA-KFIN=0, and "NO PART ..." is displayed instead of its
description), because the related file, TOOLPROD, may contain such parts. The
second START (with no READ) ensures that, if the current part is invalid, the
READ PART NEXT at the end will read as next one the same record. The part may
be invalid only for the one entered -- after that the following parts are
retrieved, as usual.

122.2. See note 122.1; here the related file is PURHIST.

122.3. ** See note 122.1. If part is invalid, clear PH-CAT so that PART-TYPE
will set PART-CODE=0, i.e. undefined type. ** PB-KQ is used to loop twice
through the bins for the current part, in order to list the SQxxx
(quarantine) bins together at the end. This applies only to materials (the
other bins are then SYxx and SIxxx); for others the second loop would find no
bins and would just take extra time, so prevent it.

122.4. See note 122.1, for MACHINE records.

123. ** TQ-DF is same size as XM-F1 and TH19/TH20. ** TQ-DF is needed also in
TQ-EXP, using the fields offset and size and the TQ-DF11 contents.

124. It is possible to end up with an invalid M.O. in an existing line or in
a new line, even though the system checks and displays a message, because
that line remains wrong if the user does not correct it. There is no point in
deleting that line, or displaying additional messages, since this situation
is similar to an M.O. being deleted later in various ways. The sections that
use the short schedule must allow for, and ignore, invalid M.O. nos.

125. TJ-DF is same size as XM-F2.

126. Page 2, if it exists for this drawing, is automatically included
following page 1 simply by including all records with the same drawing no. in
key. Both the page 1 and 2 header records are skipped by skipping records
with line 0.

127.1. ** LA-RECORD must be in memory when calling BAR-LAB. ** Before calling
one of the BAR-LAB-xx procedures: set the fields used in the specific
procedure, ED-LABINF, PRO-ENG, PRO-QUAL, PRO-HARM, BAR-LABQTY, BAR-QSER,
BAR-PROD, BAR-DESC, BAR-LOT, BAR-QTY, BAR-CUSORD, BAR-SUPPLIER; also call
BAR-LAB-NAME (to set BAR-NAME, BAR-ADD1, BAR-ADD2, BAR-POST) if calling
BAR-LAB-GMSHIP or BAR-LAB-AMAX. This is not a complete list. The PRO- fields
too should have equivalent BAR- fields (and MOVE to those fields before
calling the BAR-LAB-xx procedures), but there are too many changes, so they
are now used directly (BAR-ENG is set and used in some BAR-LAB-xx procedures,
to suppress trailing spaces). If calling through BAR-LAB (UL, IS), they are
set in BAR-LAB; if calling through BAR-LAB-SHIP (i.e. as shipping labels:
-GMSHIP, -FLEXALLOY, -AMAX, -FASTENAL, etc.) and master labels, set them
before the call; BAR-QX, etc. (field length) are calculated both in BAR-LAB
and in the BAR-LAB-xx procedures, so when calling through BAR-LAB this is
done twice. BAR-LAB-xx procedures that may be called through BAR-LAB-SHIP or
directly must also read and increment IF-LABNO to set BAR-SERIAL; when called
through BAR-LAB, SET-LA did that, and LA-NO is used as BAR-SERIAL (see also
note in SET-LA); so, when called from BAR-LAB, when BAR-SERIAL is set in a
BAR-LAB-xx procedure that value is ignored and IF-LABNO is incremented again.

127.2. ** See note 127.1. BAR-QSER is always 1. ** The check for BAR-LOT >0:
the lot is not known when HL-ERR=1 (see ID), and in this case do not print 0
but leave it blank so users can stamp the actual lot when shipping. **
BAR-SERIAL is part of BAR-LICENSE and is in the least significant position of
that field, so the ^SN automatic incrementing (used for both the bar code and
the readable part) would work (see Zebra manual). However, BAR-LICENSE is
also used in the 2D bar code, where there is no way to use the ^SN feature,
so all labels would have the first serial number. The solution is to forgo
the ^SN feature and use instead the variable field feature ^FV/^MC, and a
loop executed BAR-LABQTY times, incrementing BAR-SERIAL after each label; the
actual labels qty in ^PQ is thus fixed 1.

127.3. See note 127.1. Serial no. is not used, but IF-LABNO is incremented
anyway, just by 1.

127.4. ** See note 127.1. See note 127.2 on BAR-SERIAL, variable field
feature. ** Do not call BAR-SET-SERIAL here -- for AmAx the set of serial
nos. is reserved earlier (master + 18, or 36 for Mexico), and BAR-SERIAL must
be set before call. ** AmAx needs 2 labels/carton, both same serial no.,
printed consecutively; hence the nested loop of 2 iterations. BAR-QSER is
still 1: cannot use this feature, because of the different code for the first
and last label -- see loop. BAR-LABQTY is the number of pairs, not the total
labels.

127.5. See note 127.4 on BAR-SET-SERIAL.

127.6. See note 127.2, but here there is only one label (BAR-LABQTY is always
1), so neither the ^SN feature nor the ^FV/^MC feature and loop are needed.

127.7. See note 127.6.

127.8. See note 127.1. Serial no. is not used, but IF-LABNO is incremented
anyway, just by 1.

127.9. ** See note 127.2 on BAR-SERIAL, variable field feature. **
BAR-LAB-QSS-SETPROD is used also in BAR-LAB-QMASTER.

128. KH-PAGE is used in KH and KF.

129. Make total price = weight in lbs, and then make unit price = price/M;
but recalculate total price from unit price to make sure the extension is
correct as printed (in case the rounding caused a difference of 0.01).

130. ** AmAx seems to have only one pair/LIN segment, so there is only one
entry in the IP table (the table is cleared for each LIN), but the loop works
as if there could be any number of pairs. ** When this is just the report,
include everything. ** Ignore pairs earlier than previous day (skips weekends
only, so this may not work properly on U.S. holidays); if from previous day,
add them to today's pairs but only if they were not processed already; i.e.,
only if they were sent after previous day's DELJIT run. To find out, check
the pulls in previous day's DELJITEX records for that plant. AmAx sends LIN
entries from many prior days (i.e. pairs with old dates), until they are
physically received by them; so those already processed should be found in
the previous day's DELJITEX. There may be a problem if more than one day has
passed -- only one day back is checked now. ** The IP-ATOT statistics
(printed at the end of the report) are useful to see how many entries are
superfluous, for past qties. ** Also ignore lines with no pull (i.e. no AL in
the GIR segment.

131. ** AmAx logic is different from the others: each LIN entry is for a pull
(pallet), and they may have many LIN's for the same product in each DELJIT,
for several products, and also several DELJIT's in one day, with the same
plant-product more than once. The first LIN for a given plant-product (DAYREL
key) that day creates the DAYREL record and the associated DELJITEX, and the
following ones add to the qty in DAYREL, and to the table of pulls in
DELJITEX. The other DAYREL and DELJITEX fields are set the first time, and
they should be the same for all the other LINs for that plant-product (only
DY-INFO is different for each LIN, but there is no way to store all the
LIN's, and this field is only used in the RO report anyway). ** When either
adding a new DAYREL record or modifying an existing one, there is normally
only one qty-date pair in the IP table (because AmAx has only one pair/LIN
segment, and the table is cleared for each LIN); there are some loops similar
to the non-AmAx part to allow for any number of pairs, but this is
superfluous here. However, some of the logic assumes one pair, and uses
simply xx(1). There may be different dates in different passes through this
logic, but the system cannot cope with more than one pair/DAYREL, because
there is only one list of pulls in DELJITEX; so, although all pairs for today
and the future are read and printed, only the earliest date is added to
DAYREL (it is assumed that the first pair read, when creating DAYREL, is the
earliest). Then, the logic that updates an existing DAYREL record is bypassed
if the date is different from the date already there; these pairs will be
found again the next day, since AmAx keeps sending them; and even if there is
no DELJIT the next day, they will be found later as pairs with a past date,
and accepted, because they will not be found in the DELJITEX check for past
pulls. ** AmAx repeat entries the same day, and there is no way to detect
this; the only solution is to set a maximum qty/day and stop there when
adding a new qty; this maximum is calculated as the product of the packing
qty, number of pulls found so far, and cartons/pallet (18, 36 for Mexico); it
is assumed that each pull is a pallet.

132.1. This loop assumes that all PROC-RECEIVE types are in the range 845 -
850.

132.2. See note 132.1.

133. LOC must follow immediately NAD+ST.

134. Do not perform AR-PAGE here -- it must be performed only after setting
AR-TITLE the first time.

135. CSV-DFLDS must be identical to CST-DFLDS.

136.1. ** RC23 loop converts ML-WEI-MAX (kept in tons) to lbs for ease of
calculations; it is converted back to tons at the end. ** REPFL has the M.O.s
in reverse order by date within each part no., in order to apply the M.O.
weights to the mill cycles in the main mill loop backwards, just as the mill
cycles are read backwards.

136.2. If there is weight left after reading all M.O.s (this can happen if
some of the M.O. dates are earlier than the earliest available mill cycle, so
they were ignored in the mill loop where the cycles were read backwards),
apply all the weight left to the earliest available cycle; also include the
logic for the maximum permitted cycle weight: apply the difference to the
next cycle, etc., using MWEI (current) and LWEI (left), just as in the
previous, main mill loop.

137. ** Scan REPFL to set the cost field; it was not set when creating the
records, since it is the same for each process-product combination, so this
way it is done only once for each record in REPFL. ** At the same time, set
indicator to 1 for those records that must be ignored in the report; these
are the records for a given process if all of them had cost 0 (which happens
when OP-COST is 0); so, when at least one product in a process is not 0,
print all the products in that process. To check this, it saves RP-KEY at the
beginning of each process, uses the dept/sect/mac fields to identify changes
in process, and if ER-SW=0 goes back and sets the indicator to 1 in these
records. Still included are those products where the cost column is 0 due to
the qty column being 0 (the cost itself is not 0). ** ER-SKEY is cleared in
ER4 to ensure that the last record in REPFL is modified, since if ER-W is
called here, ER-SKEY was not set to the record following the last one to be
modified (since it is normally in the middle of the file); it points to this
last record, so the condition =ER-SKEY in ER-W3 would stop there and not set
the indicator.

138. ** Update PE fields before CHK-BIN-EMPTY, since this uses some BIN
fields that are cleared if bin is emptied. ** Bypass PE and BIN update if
somehow an empty bin, with blank product field, was specified and accepted
with "OK" earlier -- this would create a PE record with blank product as key.

139.1. ** The condition IF LG-IX > 1 AND ...: If two consecutive DAYREL
entries have the same date, must create a separate extension, because there
may be two shipments the same day, so it must bypass the logic that compares
qties, which would simply replace the first qty with the second in the
existing extension. This also works with more than two entries with the same
date. ** LG-AQTY holds the qty for a regular extension added in LG-ADD, and
LG-NQTY holds the qty when the extension is added to make up for a change, up
or down, and must be set before calling LG-ADD. If DAYREL does not reflect
previous day's shipment (see below), when calculating the qty to be shipped
LG-QTY-NEW is checked in order to ignore the qty from the previous day:
ignore the extension entirely when the qty was added (HL-QTY-NEW>0), or add
the qty back when it was deducted (HL-QTY-NEW<0); otherwise the qty in the
extension may look wrong the next day and the program may delete or modify it
-- it cannot determine that its purpose is to correct a past discrepancy. **
The condition IF DY-DATE < SYS-DATE (in several places) decides which of two
methods to use: if less, it means that no DAYREL was received that day for
that product and the DAYREL qty does not reflect the changes made the
previous day, so HL-QTY-NEW is deducted (can be +/-, see above); if not, TQTY
is deducted (sum of previous unshipped orders, which will be shipped that
day). In LG5, for GM Sunday releases, TQTY is always used; there is no check
-- this can only happen on a Monday, so obviously DAYREL reflects Friday's
shipments. Thus, both TQTY and HL-QTY-NEW are calculated every time, but only
one is used for a given pair.

139.2. See note 139.1.

140. EXTEND-PR is only for reports, when a report uses the print file started
by another report and calls PR-PAGE first thing after opening it. AFTER PAGE
is needed here because WS-PAGE is 1, so PR-PAGE will perform AFTER 0, not
AFTER PAGE; AFTER PAGE here creates a blank line as the first line on the
next page, but the AFTER 0 of the next report will cause the first line there
to be over this blank line, so there are no spurious lines.

141. ** D-LOTDATE converts lot number to date. Converts the lot's one-digit
year to real year; it is assumed that the lot never refers to a date later
than the system date, but may refer to an earlier date; this works even if it
refers to a later date, as long as it is not a later year (if it is, it will
result in a date 10 years earlier). ** Lot must be a valid value, i.e. the
day part must be 1 - 365 (or 366 in leap year), otherwise the resulting D-DT
and D-DATE are set to 0 and D-ERR to 1. D-YEAR, however, is not cleared; this
is to allow the use of this procedure to find the year even in invalid lots
(apparently users deliberately create lots with days 4xx, etc. for special
purposes; also, this may be a value like B-LOT, which is not checked against
existing lots when created manually). Must check D-ERR after call only where
an invalid lot is unacceptable. Thus, there is no need where a from-to lot
range is entered for a report, or where only the year is used.

142. BAR-LOT must be set before calling BAR-GET-LDATE. D-DATE must also be
set, but is needed only if the lot number is invalid or yields an invalid
date.

143. For the summary print file, open and close it in order to create it,
since it must be opened with EXTEND-PR in LG-GEN-EXTEN (which is called also
from GB, where the summary print file is shared with other reports). The
detail print file is only used in LG-GEN-EXTEN, so it can be opened and
closed there normally.

144. ** BAR-LAB-FLEXALLOY, BAR-LAB-FASTENAL, BAR-LAB-SATURN can be called
through BAR-LAB-SHIP (in which case no LABELS record is created), but can
also be created in IS with LA-SRC=0 and in CE with LA-SRC=1 and then called
from BAR-LAB. BAR-LAB-SATURN can be called through BAR-LAB-SHIP and also from
ID with LA-SRC=2. BAR-LAB-GMSHIP, BAR-LAB-AMAX can only be called through
BAR-LAB-SHIP, and also directly. When a BAR-LAB-xx procedure is called
through BAR-LAB-SHIP or directly, the BAR- fields must be set with
BAR-LAB-INIT and directly; when called through BAR-LAB, they are set there
from the LABELS record. (So when called through BAR-LAB some fields are set
twice.) ** Type 7 is BAR-LAB-GMSHIP; no LABELS record is created for this
type (there is no actual LA-TYPE=7), so no PERFORM is included here. ** Type
9 is BAR-LAB-AMAX, see type 7 note above; but there may still be references
to this type in BAR-LAB and SET-LA, since AmAx used to have LABELS records
too; they are harmless, the condition is simply never encountered.

145. The automatic labels option is no longer relevant (Jan 2008), since
labels are no longer created automatically in IS. (Instead, indicator is set
there to approve the labels, and they are created later in CE.)

146. DESC-AMT converts numeric value in DSA-VAL into words, for printing on
cheque. First builds the whole string in DSA-LN, then separates it into up to
4 lines (in the same area -- by shifting substring backward one character if
a line starts with space, or forward several characters if a word straddles a
line boundary). DSA-LTH value must be the same as the line length (DSA-LINE,
currently 39). At most 137 characters are used in DSA-LN (when all nine
digits are "SEVEN"); more may be needed after separating text into lines
(worst case is about 20 more, so text still fits in 39*4=156 characters).

147. Since PRINT-PLORD is used in several EDI functions, must use PR-LINE
(rather than AC-LINE, etc.), so there are no page headers; but this is not a
problem, since the listing is usually empty, or has only a few entries, and
with 5 entries/line it never reaches the second page.

148. ** MAINTA is created in AK-E850, so BK-E855 must be called only after
calling AK-E850. ** If MAINTA is empty (there were no 850's) create an empty
EDI 855 file. If not checking here, it would create the ISA/GS segments, and
nothing in between.

149. Must create a separate DAYREL record for each SCH segment (because
some fields, like DY-ORD, may be different), so there is only one date/qty
pair per record. This can result in several records for the same
plant/product if there are several PO1/SCH segments with the same product
(DY-SEQ will then be incremented).

150.1. For record type 3, use WS-EFF-DATE instead of the system date, since
this is the date needed in audit printing when selecting records by date.

150.2. See note 150.1.

151. ** For GMC and AOS, the EDI header and trailer are created in the CC3
loop. For the other types, they are created outside the CC3 loop (one
envelope for the entire file), so for them check if any 856's would be
generated, and do not create an empty envelope (header and trailer and
nothing between them). This applies now to: TRW (X12 plants), etc.; when
adding a type, search for UC-IND to update all references, and extend the
UC-XIND table as needed. CHRY and UTA are ignored in the UC-IND logic. The
entry in the table is the RD307 function number, so the table size must match
this screen, although not all entries are actually used. ** For TRW EDIFACT
plants there is no need for this check in IC, because the DESADV header and
trailer are created in the IC3 loop.

152. Size of PC-ATOTALS must be the same as RP-F337.

153. ** The cheque number and totals are stored in REPFL in the cheque
creation stage, to be used in the file update stage. ** WS-CHQNO is
incremented for each vendor, but also when more than one cheque stub is
required for the same vendor, to skip the pre-printed cheque numbers; but the
first number (i.e. the one on the actual cheque) is stored in REPFL, to write
it in APTR. Only one stub is printed, up to 14 lines; if more, nothing is
printed on the stub and the lines are printed on the remittance listing. **
PC-WIND is first cleared, then set to 1 for those APTR records selected when
read the first time, to ensure that exactly the same records are selected in
the file update stage as were in the cheque creation stage. This is just in
case a new APTR record is added by another user between these stages, with a
date that would cause it to be selected in PC-K. ** It is confirmed before
starting that the next 1000 numbers are free (see condition AH-NO > WS-CHQNO
+ 1000 in PC1), so there is no need to check for duplicates when incrementing
the cheque no. or when updating APCHQ. (A duplicate can exist either if more
than 1000 numbers are generated, or if a cheque in this range is added
manually by another user while PC is running.) ** For special vendors
(CHK-VENSP -- payments to employees, all using the same, dummy vendor) a
separate cheque is generated for each APTR transaction (PC50), using the name
and address stored in APTR; in this case the cheque number is incremented for
the second, etc. transactions.

154. Display the next message by overwriting the previous "please wait"
(i.e., no "ADD 2 TO IXT"), since there are not enough lines left to the
bottom of the screen for the following messages. The last message will be on
line 22.

155. There are not enough lines for all descriptions, so the printing
priority is: DESC-FR, DESC-EXT, DESC-FIN. Must match this priority to the one
or two lines available (depending on BAR-UPC and the advisory note). This is
complicated by the fact that the printing order is different from this
priority. The two lines are set up here based on the priority, but this may
be modified below if only one line is available.

156. ** The case of GEN-NUT>" " is only approximately taken into account in
counting the lines to pre-calculate the number of pages: it simply adds 4
more lines to the total for the nut description, and 2 more lines later for
the space between products. So if there are fewer than 4 lines it may start
the next page too early; if more, it may underestimate the total for the
current page and fail to start the next page in time. These orders have
usually only one line, and only rarely there is more than one page. If it
underestimates the lines, it will simply start another page later, when
printing, and the likely error will be the total number of pages shown in the
heading (e.g. "page 3 of 2"). ** When counting the bin lines in ID37 both the
bolt and the nut lines are added (the loop does not look at BA-PROD, as it
does when actually printing the lines in ID-BLINE) and this total is compared
with the total description lines for the bolt and nut. ** There is an
additional check for GEN-NUT when printing, to start another page if less
than 3 lines left on the current page (the HL-PAGE indicator only applies to
the bolt; there is only one indicator per order line; the bolt and nut should
normally be printed together), simply to keep at least the first couple of
product description lines together if the lines were miscalculated and the
nut description ends up printed on two pages.

157. BA-BN is bolt-nut indicator: 0 for normal product, 1 for the bolt in
Victaulic bolt-nut, 2 for the nut. Only Victaulic have bolt+nut products now,
so 1 or 2 means Victaulic product. It is assumed that for Victaulic products
BINALLOC records are added only here, never in the other places in
ID-ALLOC-LINE, so in the other places BA-BN need not be set and is 0.

158. The SCAN- procedures read bin (and bin level), lot, product numbers
entered through mobile scanners. When read by scanning the barcode (rather
than through the keypad), the value is prefixed with B, L, P, which must be
ignored.

159. Before calling CALC-TARGET: P-RECORD and M-RECORD must be in memory, and
PROC-TYPE must be performed.

160.1. ITPRODUCT, ITMACHINE, ITOPERATIONS are the files of Irvine Tools, so
they must be identical to PRODUCT, MACHINE, OPERATIONS. They are needed when
accessing these files while in the Irvine Fasteners directory.

160.2. See note 160.1.

160.3. See note 160.1.

161. ** For options 21 22 (JJ-KEXP=1, create export file only), REPFL must
include both regular and blanket orders, so both parts are executed, one
after the other, jumping over the print loops. The regular ones have the
product field blank in REPFL, and this is how they are recognized when
reading REPFL. ** JJ-KN logic: Cannot simply check for new products when
reading REPFL, since break headers and totals (by salesman, customer) would
be generated even with products in that portion (when no products are new in
that portion). For regular orders, must check in the initial REPFL creation,
to include an order only if there is at least one new product; and must still
check when reading REPFL, to skip the others. For blanket orders, there is
only one product per order, so can check when creating REPFL and only new
products will be included and there is no need to check when reading REPFL.
When creating export file, REPFL is created in the same way and includes both
regular and blanket, so must check only the regular ones when reading REPFL.

162. Several other operations are performed only for MM=12 -- see CUSTOMER,
PRODUCT, etc. update in earlier RL parts.

163. For Victaulic-type nuts, ignore the actual nut allocated qty and weight,
and assume instead that the same percentage is allocated for nuts as for
bolts. This is needed to calculate total truck load correctly: if fewer nuts
than bolts are allocated in the first allocation, the weight in the second
allocation in ID will be higher and will exceed the total load weight
specified here.

164.1. Irvine Nuts may use 7-digit invoice numbers, but the invoice number is
also used for B/L, which has 7 digits, and in this case the two must be
equal. The most significant digit is automatically ignored for the invoice
number (since TR-INV, O-INVNO, etc. are 9(6)), but it must be specifically
erased in TR-BL, O-BL, etc. which are 9(7).

164.2. See note 164.1.

165. RD226 is used in FK and VX.

166. For this sender-id (Teleflex Automotive) do not generate a CONTRL file:
skip input lines to the next UNB.

167. LG-P (invoked before and after the new extensions are generated) creates
the "old" and "new" extensions table for printing. Only up to 6 extensions
are included, and only from today to one working day ahead. Print the
plant-product data (DAYREL data and the extensions table) only if the "new"
are not identical to the "old" -- but for GM and AmAx always print them.
There may be 0 "old" or "new" extensions.

168. ** BAR-STRD is used to print string when the width of the dash "-" must
be set as half the type size (usually just for large type sizes), because in
font A0 the "-" is extremely wide, so it looks bad and takes too much space.
It prints separately the "-"s and the parts between "-"s, so that the width
can be set accordingly. ** Condition IF A-X2>0: A-X2 can be 0 only for
consecutive "-"s, or in first pass through loop if first character is "-". **
Initial ^FT (BAR-B) defines only the position of the string, with no data, so
that all the characters can be scanned the same way in the loop. This ^FT is
also needed in case the string has 0 length and the call to BAR-STRD is
followed by an ^FT with no position (to position the next string immediately
following the previous one). Since the printer does not accept ^FT alone on a
line, or an empty field (^FD^FS is invalid), must send a dummy field of one
space; with font A0,1,1 the space should be 0.3 dot (i.e. 0), but the printer
leaves a space of 2 - 3 dots (presumably some default minimum, since it is
the same for A0,3,3); normally this is irrelevant, but if it must be precise,
set BAR-BY = A-N2 - 3 (check if result<0, set to 0).

169. Usually SL-SLIP guarantees key uniqueness; SL-SEQ is needed in case the
subcontractor splits an order and has several lines on the same packing slip.

170. Must call DI-END before reading current YOK record and moving fields to
OK record, in case DI-PAGE is called from within DI-END (through DI-LINE), in
which case the previous YOK and OK fields are still needed there. This also
applies when DI-END is called at EOF in DI9. This is why reading YOK and
moving fields is done in two places here.

171. These values are stored for use in DI-END. Only the first OK record in
each invoice has these values. The others are 0 (see IG and IH) except OK-US,
which is not updated in IG/IH and should be the same for all orders in the
same invoice. So here the values are simply added together (rather than using
for each one IF OK-xx > 0 MOVE OK-xx TO DI-xx) except the indicator fields,
which can be only 0 or 1.

172. ** CHK-ZERO, CHK-DZERO: must perform this conversion for fields declared
as 9 COMP-3, before being moved to fields declared as 9 (display), in either
of two cases: if they are only one digit, or if they are initialized with
LOW-VALUES and may still contain binary 0's. This is needed because in these
cases the system moves a corrupted value. ** COUNT-ZERO, LEAD-ZERO return (in
A-N1) the position of first non-zero digit in a numeric field; COUNT- is more
general, needed when the returned value A-N1 must be applied to the original
field, which must be DISPLAY, not COMP; it can be called several times and
the results used later. LEAD- is useful when the original field is COMP and
A-U1 can be used as result directly. To call COUNT-: set A-U1 = numeric
value, A-N1 = total number of digits of the field to be used (if 9(x).99, set
A-N1=x). A-N1 must be the field size (not the maximum expected or wanted
digits) so that the returned A-N1 is the position of the first non-zero digit
within a field of that size. Thus, the returned A-N1 must be used with a
display field whose size was in parameter A-N1. Alternatively, set A-N1=18
regardless of the number of digits, and use A-U1(A-N1:) instead of the
original field; COUNT- then becomes identical to LEAD- (which does not
require to set parameter A-N1).

173. Table numbers and descriptions:

 1. TERRITORY
 2. PRODUCT CATEGORY
 3. STD. TEXT
 4. BROKER NAME
 5. PROCESS TIME
 6. DISCOUNT
 7. PART G/L
 8. STD. DESCRIPTION
 9. COMMODITY CLASS
10. PART CATEGORY
11. PLATING
12. PROVINCE
13. TICKET COLOUR
14. COUNTRY OF ORIGIN
15. HARMONY SYSTEM
16. CUSTOMER TERMS
17. PRODUCT MARKET
18. PRODUCT FAMILY
19. MACHINE GROUP
20. PLATING SPEC
21. (NOT USED)
22. MACHINE TYPE G/L
23. FRENCH STD. DESCR.
24. PHYSICAL SPECS

174. R-FIN=1 means M.O. complete -- set when primary machine operations are
completed. R-PUR=1 means purchased part -- set when primary machine is 8.
R-QTY-LEFT determines whether the M.O. is closed: if >0 it is still open (may
also be <0, but becomes eventually 0, when the M.O. is closed by the system
in BN and R-QTY-REC is made = R-QTY-PROD). This is used in PRODORD loops to
decide which M.O.s to read, and in IFMAINT year-end maintenance to decide
which M.O.s to keep.

175.1. See note 100.1. YOK-PR is set to 2 for automatic subcontractor
invoices, as opposed to 0 for normal, manual invoices; this indicator is used
when printing dummy invoices; for both, it is set to 1 after printing. So
YOK-PR has a dual function: to indicate type of invoice, and to indicate when
the invoice was printed. See also note 175.2.

175.2. It is possible to read here PURORD and use OK-SUBCON to determine if
this is a subcontractor order, but that would not be quite the same test,
since in principle one can invoice a subcontractor record manually, and this
loop should select it then under the "manual" option.

176.1. Subcontractors that perform sorting also pack the parts, so empty
cartons and skids are included in the shipment and are added to the parts on
B/Ls and customs forms. The carton and skid B/L totals are entered at the end
of the B/L and stored in the first SUBCON record in the B/L set of records
(see GS83). Process 458 (Curtis) does plating, and needs cardboard pieces to
line the buckets when shipped back. No one B/L has all three.

176.2. See note 176.1. The cartons and skids ADD's will only find the totals
in one of the records read in the loop (or in none for B/Ls where this does
not apply), so summing the values with no checks is the simplest way to
retrieve them.

177. The run parameters for option 4 are not stored for batch execution. They
are kept only in the local variables, so the report with option 4 can be
included only once in a batch run.

178. For users with a PC rather than a VT terminal: Reflection VT330 terminal
emulator does not support pages (SIXPG1/2 commands are ignored -- the display
is always on the same page), so for the Select key must re-create the page
image with SDR-DSP (which re-sends the page, so had to be avoided earlier
because too slow with serial connection, but now all are on network and is
the default for new users).

179.1. For Delphi, when BAR-LAB-xx is called through BAR-LAB it means it is
called from ID; in this case each label must be printed only once, for one
carton, because the kanban numbers are defined as serial fields and must not
be incremented by the printer; the kanban number is incremented in ID, where
each carton generates one label. For Saturn, it is the same but they need 2
labels/carton, so both LABQTY and QSER are set to 2. For Saturn only, when
BAR-LAB-xx is called directly, as from FC and FH, if the number of cartons is
entered it is multiplied by 2 and QSER is set to 2; in this case the printer
will increment the kanban number; for Delphi even then it is only one label,
since the kanban numbers are not consecutive.

179.2. See note 179.1.

179.3. See note 179.1.

180. Use current category, from the product record, not the one from the
history record, in case the category changed since the history record was
created.

181. Use HR-LINE rather than PR-LINE in all the subtotal operations, to allow
for case of SUM-IND and TOT-IND being selected, when only these totals are
printed and no detail lines; with no HR-LINE performed, no end of page would
ever be detected.

182. ** D-DTADD, D-CDTADD: D-DAYS (days to add to D-DATE) can be positive or
negative; D-N1 (day of the week, 1 - 7) is used in D-PREVIOUS or D-CPREVIOUS,
which is called from here, so it must not be disturbed here. ** D-NEXT /
D-PREVIOUS search for first date with given week day after/before the given
date; D-CNEXT / D-CPREVIOUS start searching including the given date, so may
stop at the given date. ** D-NEXT-DAY / D-PREV-DAY search for first Friday
after/before the given date. ** D-MTHS / D-MTHSR / D-CURR treat dates as the
number of months since the end of 1869, useful in accounting calculations for
comparing dates when only the difference in months matters.

183. The title lines are 16.66 characters/inch, but the spacing must match
the actual lines, which are 10 characters/inch.

184.1. ** When changing SAORD/SALIN fields: in TMPORD/TMPLIN, YO-DATA/YL-DATA
must be large enough to contain all the used bytes of O-RECORD/L-RECORD (i.e.
space without the FILLER at the end), since the entire record is moved into
that field. ** When changing SAORD/SALIN fields or record size change
ACKORD/ACKLIN the same way (blocking may remain different).

184.2. See note 184.1.

185.1. IG-E1 - IG-E7 messages match SU-E1 - SU-E7; IG-AUDIT, IG-TR match
SU-AUDIT, SU-TR, but PT- fields not used in IG are left blank. TD-INP-R5
fields are used in both, with the same AU-K code.

185.2. See note 185.1.

186. Show first all receiver/issuer pairs (in the PLANT file) for which the
issuer field is not blank, then let the user modify the issuer field in all
the records for a particular receiver. The issuer is the same for all the
records with the same receiver, so this is simpler and safer than including
the issuer field in PG (plant maintenance), where several records would have
to be modified for each change.

187. DX-DATA must be large enough for the largest item stored in it (see
ED-DELP-DATA, etc.).

188. ** Delphi, AmAx are identified through ED-DELP, ED-AMAX; no need to use
IC-Kx (like IC-KSAT), since they are no longer together with the GM plants
(as Saturn is). ED-DELP, ED-AMAX, ED-GMC, ED-TRW are set before IC-DESADV is
invoked, and CFORD is identified from AUTO-CODE. ** All destinations use
EI-GMC-ISA as message sequence number.

189. Use SJ-MO and SJ-LOT, which are irrelevant here, to ensure SJ- key
uniqueness: place the invoice date in SJ-MO, and increment SJ-LOT from 0 in
case there are several records with the same invoice date.

190. For Irvine Nuts LK-QTY=0, since the actual blanket orders are used:
there is no original total qty, so there can be no prorating of the lot
charge.

191.1. Order M.O.s in this sequence: 1. by machine; first those on the short
schedule and then the others; 2. if on the short schedule, by their place in
the short schedule; otherwise, by the start date. So either RP-F9 is 0 and
RP-F10 is a sequence number, or RP-F9 is 1 and RP-F10 is 0; in the former
case the start date is irrelevant, since the sequence numbers are unique; in
the latter case, it is only the start date that matters.

191.2. See note 191.1, but here M.O.s are ordered by actual start date, and
also by product.

191.3. See note 191.1, but here M.O.s are ordered by other fields and the
machine is ignored.

192. The fields in T-LINE (table #24, record with T-PCN, T-PCD, etc.) must be
identical to the fields in CAR-HEAT-TABLE and CAR-MECH-TABLE: all three are
read into CAR-DATA and used the same way. The heat and mechanical
characteristics are kept in fixed, hard-coded tables here; the physical
characteristics are kept in table #24 in TABLES (see below), and can have up
to 999 entries, but a particular product can use only up to 28 of these, so
the P-RECORD table has the characteristic number for each min-max pair. (It
is in TABLES, rather than hard-coded like the heat and mechanical tables,
because users need to modify it frequently -- new ones may have to be added
for new types of products.) For the heat and mechanical characteristics,
their P-RECORD tables allow for all possible entries, so they parallel the
hard-coded table entries and there is no need for the characteristic number
(for those not used for a particular product, the min-max values are simply
0). The hard-coded and P-RECORD table sizes are equal: 18 (heat) and 15
(mechanical); if increasing them, increase also the CAR-HEAT-NUM or
CAR-MECH-NUM value. For the physical characteristics, only the P-RECORD table
and the CAR-PHYS-NUM value must be increased. These tables and the
CAR-xxx-NUM constants are used in several places, so searching for the
constant names will find other required changes; also check for related uses,
as in VA, VS, where there is a local table of the same size.

Physical characteristics (table #24) as of Jan 2014:

001.FINAL LENGTH                   .0101.032
002.MAX HEAD HEIGHT                .0101.008
003.MIN HEX HEIGHT                 .0101.032
004.ACROSS FLATS                   .0101.032
005.MIN ACROSS CORNERS             .0101.008
006.MAX FLANGE DIAMETER            .0101.008
007.MIN BEARING DIAMETER           .0101.008
008.MAX LENGTH TO FULL THREAD      .0101.032
009.MINIMUM BODY LENGTH            .0101.032
010.KNURL LENGTH                   .0101.008
011.KNURL DIAMETER                 .2001.032
012.MAXIMUM HEAD DIAMETER          .0101.008
013.PROJECTION DIAMETER            .0101.008
014.PROJECTION WIDTH               .0101.008
015.SHOULDER LENGTH                .0101.008
016.SHOULDER DIAMETER              .0201.008
017.THREAD LENGTH                  .0101.032
018.NECK WIDTH                     .0101.008
019.NECK HEIGHT                    .0101.008
020.FUNCTIONAL PITCH DIAMETER      .0401.008
021.PITCH DIAMETER                 .0301.008
022.MAJOR DIAMETER                 .0201.008
023.THREAD ACCEPTABILITY           .0503.032
024.VISUAL INSPECTION              .0704.100
025.GRADE MARKING OR SPECIAL       .0719.100
026.BODY DIAMETER                  .0201.008
027.MIN WRENCH HEIGHT              .0101.032
028.NUT/WASHER THICKNESS           .0101.008
029.UNSLOTTED THICKNESS            .0101.008
030.SLOT WIDTH                     .0101.008
031.THREAD BLANK DIAMETER          .0201.008
032.HOLE DIAMETER                  .0101.008
033.HEAD AND SQUARE HEIGHT         .0101.008
034.RECESS DIAMETER                .0101.008
035.RECESS DEPTH                   .0101.008
036.THREAD LENGTH STAMPED END      .0101.032
037.PITCH DIAMETER STAMPED END     .0301.008
038.MAJOR DIAMETER STAMPED END     .0201.008
039.THREAD ACCEPT. STAMPED END     .0503.032
040.THREAD LENGTH UNSTAMPED END    .0101.032
041.PITCH DIAMETER UNSTAMPED END   .0301.008
042.MAJOR DIAMETER UNSTAMPED END   .0201.008
043.THREAD ACCEPT. UNSTAMPED END   .0503.032
044.PROJECTION HEIGHT              .0101.008
045.POINT LENGTH                   .0101.008
046.MAXIMUM POINT DIAMETER         .0101.008
047.SECOND KNURL LENGTH            .0101.008
048.SECOND KNURL DIAMETER          .2001.032
049.MINIMUM FLANGE THICKNESS       .0101.008
050.DOG POINT DIAMETER             .0201.008
051.DOG POINT LENGTH               .0101.008
052.MINIMUM HEX POINT LENGTH       .0101.008
053.HEX POINT ACROSS FLATS         .0101.008
054.HEX POINT ACROSS CORNERS       .0101.008
055.HEAD ANGLE                     .1817.008
056.STRAIGHTNESS                   .1904.032
057.CORNER UNDERFILL               .1904.032
058.SHOULDER RADIUS                .1801.008
059.HEAD PERPENDICULARITY          .1904.032
060.HEX REFERENCE GAUGES           .1904.032
061.LENGTH                         .1901.032
062.NECK HEIGHT                    .1901.032
063.SHOULDER DIAMETER ACCEPTABILITY.1904.032
064.NUMBER OF KNURLS               .0704.008
065.MAX HEAD TO KNURL              .0101.008
066.BODY ACROSS FLATS              .0101.008
067.PENTAGON WIDTH                 .0101.008
068.KNURL BLANK DIAMETER           .0201.000
069.GRAIN FLOW/CLOVERLEAF          .2104.000
070.MINIMUM HEAD DIAMETER          .0101.000
071.SQUARE CORNER LENGTH           .0101.000
072.THREAD LAP CHECK               .2104.000
073.COIL SAMPLE                    .2218.000
074.HEAD UNDERFILL                 .0101.000
075.HEAD CONCENTRICITY TO AXIS     .0001.000
076.WASHER DIAMETER                .0101.000
077.HOLE TAPER                     .0101.000
078.CROWN HEIGHT                   .0101.000
079.OPERATOR TOLERANCE             .0101.000
080.BEVEL LENGTH                   .0101.008
081.END WIDTH                      .0101.008
082.BEVEL DIAMETER                 .0101.008
083.END BEVEL LENGTH               .0101.008
084.SECONDARY THREAD FUNCTIONAL PD .0401.008
085.SECONDARY THREAD PITCH DIAMETER.0301.008
086.SECONDARY THREAD MAJOR DIAMETER.0201.008
087.SECONDARY THREAD ACCEPTABILITY .0503.008
088.DOG POINT DIAMETER BLANK       .0201.008
089.DOG POINT DIAMETER THREADED    .0201.008
090.COIL TAG VERIFICATION          .0704.000
091.12 POINT ACROSS FLATS          .0201.032
092.12 PT WRENCH FIT               .1903.008
093.AUDIT AS PER B/PRINT           .0004.100
094.6 LOBE GAUGE FIT               .1903.008
095.FOLDS ON BEARING SURFACE       .0000.000
096.SPECIAL GAUGE FIT              .1903.008
097.FEED THICKNESS                 .0101.008
098.HEAD PT DIAMETER               .0101.008
099.FUNCTIONAL LENGTH              .0101.008
100.HEADED LENGTH                  .0000.000
101.SLOT DIAMETER                  .0000.000
102.LENGTH TO SLOT                 .0000.000
103.LENGTH OF STEM                 .0101.000
104.DIAMETER OF STEM               .0201.000
105.LENGTH TO THREAD END           .0000.000
106.FILLET RADIUS                  .0000.000

193. Print two tickets/page. When TK-KODD=1 the top half is printed, and
PCL-FF (new page) is sent only when TK-KODD=0. PCL-FF at the end is needed to
print the last page when the last ticket was the top half (called only if
just the top half was printed, else would add a blank page).

194. The files EMPL, LDTBL, and LDTR (employees, payroll G/L codes and
accounts, payroll G/L transactions) are from the payroll system. The entire
employee record is included, although just a few fields are used in IFOP. The
two G/L files are used only in SP, for the G/L export file.

195. All orders must be for the same plant, so the name/address and
plant/dock are simply taken from the last order in the loop. (BAR-LAB-NAME
uses the SAORD data -- the record last read in the loop.) The plant/dock can
be modified only for the first order in the loop; the program checks that the
others are the same, but only if the first one was not modified; if it was,
this is the one printed on the label (it is copied to each one of the others
in the loop, so the last one will also have it).

196. The run parameters (diameter and grade tables) are not stored for batch
execution. They are kept in the local variables, so this report can be
included only once in a batch run.

197. Subtracting 028000 changes GRT-GL1 from 133521/133522 to 105521/105522.

198. This logic creates one table entry for each unique product-lot pair.
Orders have only one product line (in which case only the lot will differ),
but the logic also allows several products. To allow for the case where no
BINALLOC entries are found (when this is run by mistake after the second
allocation, where the previous BINALLOC records are deleted), and also to
allow a user to add extra entries (for example, to create several entries
from one when the max of 36 cartons/pallet is enforced), the lot can be
modified, all 10 table entries are displayed, and those left empty in the
main loop are assigned the product data of the first product line and 0
cartons and qty.

199. Use INITIALIZE PC-ATOTALS rather than MOVE LOW-VALUES, because the
vendor totals are used later with SUBTRACT; only one entry (Can$ or US$) is
updated in a given run, so the other would be left as LOW-VALUES, which is
invalid for calculations.

200. Packing cost must be ignored if CST-LOP (last operation to include) is
before a packing operation, so: 1. must check if packing op and set CST-KPACK
before checking last op and setting CST-KL; 2. must end the loop when setting
CST-KL, to prevent possible setting of CST-KPACK for subsequent operations.
CST-KPACK is used also in the other condition after the loop, but it does not
matter that it is 0, since the condition CST-KL=1 will bypass the packing
calculation anyway.

201. Duplicates can occur only for Y3 or Y4, where the RP key may not be
unique, because not all the GT-KEY fields are used (in particular, the same
invoice no. for several vendors, as when the date is used as invoice no.).

202. The T-LINE fields layout (T-PCN, etc.) must match the fields in
CAR-DATA, since T-LINE is moved directly there when read.

203. ** Only the first 5 elements in the table are used; BJ-XC(6) is used
just as temp storage for interchanging elements when resorting the table
(this is the simplest way to have a spare element of the same size as the
table elements). ** Elements are ordered by date, most recent is #1. Store
one element per customer; keep the last SALHIST record for each customer in
the SALHIST sorting order (i.e. the most recent one), but compare SH-US too,
to allow for case of same customer with both Can and US sales (and create
then two elements in the table). When replacing the date of an existing
customer, resort the table in case the element must be relocated (because of
the SALHIST sorting order, the dates within each customer can only increase,
so the resorting (done simply by interchanging pairs of elements) needs to be
done only from that element to the left). When adding a new customer, insert
it in the proper location by date (shifting to the right the older ones,
losing #5 if more than 5 customers are found).

204.1. EPS-ALIGN aligns the paper automatically to first line after
perforation (line 1 on the form), assuming the paper was loaded by using the
Load button (with no manual adjustment). The line spacing is for Epson
FX-2180, but works with other models too if they support ESC/P codes (Esc-A
is 1/72"), although the actual spacing may have to be modified. The codes
advance 64.5 lines (from the load position) and define there the top of form,
so that the new-page statements later can be used normally.

204.2. See note 204.1.

205.1. IV-FIELDS are used in IV and IW.

205.2. IV-CALC-SQTY, IV-UPDT-REC, IV-UPDT-ADJ, IV-UPDT-TRF, IV-AUDIT, IV-TR
are used in IV and IW.

206. ** Allow up to three country codes (normally for the bolt, but also for
the nut if any) in case the allocated qty includes lots from different
countries. This is needed for the customs forms and customs EDI, to print a
separate line for each country code, with its own qty (and also its own
weight and amount -- but these are calculated in COU-LINES based on the qty
when reading CFLIN). ** The country code may be 0 (Canada), so the loop must
use the qty field to find the first unused entry. Also, if for some reason
the lot is invalid, assume the country code is 0 rather than ignore that
BINALLOC entry (which would result in no qty and hence a missing line on the
customs form).

207. The nut allocation assumes the qty is the same as the bolt qty. If there
could be 2 nuts/bolt it should call NUM-NUTS, as is being done elsewhere in
the system.

208. Calculate FL-PRICE, do not simply move L-PRICE to it -- to allow for the
case of surcharge, which alters L-EXTA so it is no longer qty x price. On the
invoice the surcharge is shown separately, but on customs forms it is not, so
the price is adjusted here (like the "adjusted" price shown on invoice). This
works because FL-PRICE is used only on customs forms and customs EDI, never
in calculations or in a place where the adjustment is shown separately.

209. ** ALTERNATES has one record for each record from PRODUCT. ALTERNATES
gets the alternates of a generic (using AL-PROD), while PRODUCT gets the
generic of an alternate (using P-GEN). See procedures RD-GEN, PROD-GEN, etc.
** AL-ALT is blank for the generic; thus, when reading ALTERNATES
sequentially, the generics are included. This is useful in operations where
both the generic and its alternates must be scanned; in operations where only
the alternates are needed, ignore the record with AL-ALT=" ".

210. For Y3 ignore empty bins: D-LOTDATE interprets B-LOT=0 as year 2000, so
the report would include all empty bins if lot 0000000 is in the given range.

211. Copy entire record following "NAD+OB+", since it may contain several
fields, and all must be used in DESADV later. Store also the line terminator
character ED-NL, and use this as indicator that an OB segment was read, in
case nothing follows "OB+" (in this case presumably a similar OB must be
included in DESADV); when no OB is found ED-GNAD is blank, and then IP-DXNO
is left 0, which eventually in DESADV is interpreted as no OB.

212. ** Before calling DX-LAB-AMAX must set index DX-IXP, either with a
particular value or as part of a loop. Before call must read HL-RECORD,
O-RECORD (for BAR-LAB-NAME); also, must execute before call: MOVE HL-PROD TO
A-A1 PERFORM PROD-RD PERFORM DESC-ENG PERFORM RD-GEN (i.e. the standard
sequence, to get the description and PRO-ENG from the alternate, the other
fields (only P-QTY-PACK is used) from the generic). ** In the carton labels
loop, there is no need to increment BAR-SERIAL by adding the number of
cartons for each lot, since it is incremented in the BAR-LAB-AMAX loop and
ends in each call 1 higher than the last one used, hence correct as the first
one for the next call. The number of cartons (LABQTY) may be 0 in any one
entry (because the table may be modified manually in FV, which may leave
empty lines); the loop in BAR-LAB-AMAX is executed LABQTY times, so the logic
would still be correct when this is 0, but it is safer to prevent the call
altogether in this case. ** DX-SERIAL>0 indicates one label only, which can
be either master or carton; also, the carton labels loop is then different --
it is used just to search for the right entry, and BAR-LAB-AMAX is called
only once.

213. The table is cleared first (in code above), in case ID was run but these
orders were not shipped. The first loop groups the number of cartons by lot,
sorted by this total descending (so that the second loop allocates them
starting with a high number, which is more efficient); this total must be the
key, so to add to an existing lot that record is first deleted. The lot must
be in the key to guarantee uniqueness, in case two lots have the same number
of cartons. The total for a lot may be very large (for several pallets, but
not necessarily a multiple), or as little as one. The second loop assigns
cartons to the table by lot, filling each pallet up to CNUM (18 or 36); WN1
is the total for the current lot, WN2 is the number still needed on the
current pallet. The total cartons should match the table (which was created
from DELJIT data); if there are too many, the excess ones are ignored; if too
few (not enough were found to be allocated), the fields for the last pallets
are left 0 (can then be filled manually in FC).

214. For this line and the next, use PR-LINE rather than DS-LINE, in order to
prevent the >60 lines check: this goes to 62-63 lines, but must be kept on
one page.

215. Call with A-S1=1 to clear the three qty fields, with A-S1=0 to skip the
clearing (to save time) when already done before call.

216. ** For "freight not paid to vendor" add freight to special account, same
sign as AT-GROSS, since in IG it was not included in AT-GROSS. But the actual
distribution of freight according to the individual lines, done below, is
identical to "freight paid to vendor". ** For "freight not paid to vendor"
add an exchange entry for the freight, with the same account, needed only to
recognize the freight amount as US$ in SP (which is based on finding an
exchange entry in GLTR with the same account, invoice, etc.). But must add
then a second entry with the negative amount, to balance, so this one uses
GRT-SYS=0 rather than 1 (just in order to avoid duplicate key -- GT-SYS is
never critical, it is just for information). So these are both dummy entries,
just for the G/L export file.

217. Option 4 is identical to 3, but also creates a summary. So it does
create a print file, just like 3, although the display says "only export
file" (the users simply ignore the print file); only the summary is "only
export file".

218. ** Do not add a WORKSHEET record if an error was reported, in which case
the PURLIN record was not updated either. ** SL-MO can be 0 only if INUT is
true, in which case no WORKSHEET record must be added and the SL-J fields are
not set up in GC. But use the SL-MO NOT=0 condition anyway (rather than IF
NOT INUT), in case SUBINV records will be added in the future in other
sections without setting the SL-J fields.

219. The serial number is 0 when this pallet was created by the system in
IP-DELJIT, but could not be allocated in ID (insufficient stock), and the
users add the lot/cartons details later here. When the pallet entry is added
here, the serial is assigned even if no lot/cartons are entered.

220. ** For via code 46 (Fastenal, which can have more than one customer but
all customers are bundled together with one total at the end), either entered
directly or encountered while scanning codes, create a sort file (to sort by
customer order 2-character prefix, etc.) and skip those SHIPORD records
(while building the sort file), saving a pointer to the first record
following them. Then scan the sort file instead of SHIPORD until reaching its
end, and continue from that pointer. The sort file must be deleted at that
point, or when exiting the section, or if entering a new code while scanning
it, or if codes 46 happen to be the last in SHIPORD. ** Must read the SAORD
record because HO-CUSORD is blank for non-blanket orders (it is not copied
from SAORD in LC -- in blanket orders it is copied from DAYREL in LG). It is
not copied because it may be modified in SAORD after creating the SHIPORD
record, in which case the change would not be reflected in invoices, etc.,
where SHIPORD is tried first (see GET-CUSORD). ** The checks IF OLD-C=" " (in
LQ-C), IF OLD-A=" " (in LQ-P) are needed for the case when these are called
in LQ88 (where there is no check >" " as in LQ5) following a ship-via code
with no entries displayed (because of the selection criteria); otherwise, a
line would be displayed "TOTAL 0" and no name, which is confusing.

221. ** EL-CLR fills area beyond end of line with end-of-line characters, in
case the program will try to read beyond the actual end-of-line character
(fewer fields than expected); ED-NL must be set before call. This clearing
creates in effect 30 extra empty fields. Without this, the line would contain
whatever data was read in previous records, if these were longer than the
current one, or blanks or binary 0 if shorter, which would result in reading
invalid data past the end-of-line. The only way to ensure that scanning stops
at the end-of-line is by checking for this specifically, which defeats the
purpose of the UNSTRING features. EL-CLR is used now only where found or
expected to be needed: JQ, JS had missing field in RMR; AC for PKG, to ensure
WA1 - WA4 and ED-LINE are blank if fields are missing, and for FST, to ensure
WA1, etc. are blank. May need to include it in other EDI functions; at most
two READ EDI in each function need it (see JQ, JS). ** This clearing method
does not work for EDIFACT files (IP IQ WI GJ AW HF), since there are two
levels of UNSTRING. The method used now is to fill ED-FIELD with the
separator ":" (part of UNSTR-RECORD macro) and clear WA1 and WA2 (whether
used or not in that loop) in case there are fewer fields than expected at the
first level; WA1 and WA2 may be used at either level, and must be cleared in
any case, since there may be fewer fields at either level. The effect is then
similar to EL-CLR. EL-CLR would work for the first UNSTRING level (in which
case filling ED-FIELD would be useless, since it would be cleared by UNSTRING
if fewer fields) but then the second level would fail if there are fewer
fields than expected within ED-FIELD too, in addition to fewer at the first
level. UNSTRING moves data like MOVE, so the clearing of WA1 and WA2 is not
needed in case the field scanned is empty or too short, but only if there are
too few delimiters and scanning ends too soon.

222. Last digit is check digit added by the bank to the actual cheque no.

223. Bins SQxxx (Steel Quarantined) are used to store coils with material
suspected defective, which must be ignored in certain operations (see places
with BH-NO(1:2) = "SQ").

224. Must use the IF-SAV-xx fields to save the previous month totals because
DS is run with the G/L MTD update option enabled, and then SP, at the
beginning of the following month (since must wait for some accounting
details). The fields IF-SALMTD are cleared now, and DS uses the saved values.

225. LT-GRADE is blank in records created before Mar 2 2006 (when this field
was added for the grade override logic in IS), so for them print HE-GRADE, as
before. Also, LT-GRADE can be made blank in BW, after the lot is created.

226. Create first SORTFL to sort by bin/part/M.O. and combine all entries for
the same M.O. into one record (only the coils and weight are different and
must be added; the other fields are the same, so simply store PT-KEY of first
record and get the fields from there later). Then define the groups with same
bin-part (normally the bin identifies a group, but include part to allow for
case where a bin is used for several parts in one day): set SR-F149 to mark
the first record in each group, and also set there the total coils and weight
for the group, so when printing can read them directly; show them for first
line in each group. Also mark the first record in the first group on a page,
by setting the total number of rows in that page; when printing, this is used
to identify a new page and to calculate the length of the vertical lines. The
logic prevents splitting groups between pages, so each page may have a
different number of rows. To modify the previous SR records, must store their
key and read them later; when doing this must read again the current SR
record (with READ NEXT, to prepare for next iteration).

227. Users may enter dummy bin 101A, 101B, etc. here when shipping directly
from the floor, which has any lot and product (even 0 and blank), since the
users do not fill in these fields every time; or for products like "H"
(handling charge), in which case the lot entry and bin and BINALLOC update
are bypassed. Allowing a different product also takes care of the situation
where there was a different product in the actual bin.

228. The loop must deal with long values (when the LT-MECH field is used for
5 readings, allowing for comma + space between them), which do not fit in 28
characters. Currently only #6 (35 characters) is a long field; #1 is also
long, but only 20 characters (26 after one space plus unit, hence the 26
limit in loop, to ensure that #1 is treated like the short fields). Since
there is only one long field, and only for cat 55, which has in total only a
couple of the LT-MECH fields filled in, the logic is kept simple: the long
field extends into the following field (which is given no title); but if this
is the last field on the line (3, 6, etc.), it is skipped. There are no
checks for exceeding the 15 fields, since at most 2 fields are lost. This
logic must be improved if additional fields are made long.

229. The EL- procedures perform data conversion in EDI input operations. **
EL-RDNUM converts the alpha value in ED-ANUM into a numeric value in ED-NUM.
** EL-RDVAL converts the alpha value in ED-LINE into a numeric value in
ED-VAL; the number can have decimal digits and a "-" sign. ** EL-RDATE
converts the alpha value in ED-LINE into a date in D-DT and D-DATE and time
in D-TIME, according to the qualifier in ED-DFQUAL. ** EL-RADATE converts the
alpha value in A-ADATE into a date in D-DT and D-DATE; the alpha value is in
the form "DD MM YY", fields separated by " " or "/" or "-", DD as 1 or 2
digits, MM as 1 or 2 digits or 3 letters (Jan, etc., upper or lower case), YY
as 2 or 4 digits. If invalid, the bad field(s) in D-DT will be 0 and D-DATE
will be 0.

230. EL-CSV processes line from file with comma-separated fields (CSV
format), to prepare it for UNSTRING. Must be called after a record is read
into ED-RECORD, with EDI-SZ as its actual length; ED-RECORD is modified here,
and EDI-SZ is reduced to reflect the shorter length; ED-NL (which must be set
before call) is inserted to indicate end of line for UNSTRING. Fields with
commas in their values are enclosed in '"'; but must allow for any number of
such fields, since sometimes even fields with no commas are enclosed, and
even numeric fields. So first there is a loop with two stages, to find and
eliminate the start and end '"' (by shifting the rest of the line back one
character); the commas in the field are then replaced with "\" (which can be
replaced back with commas later, after reading the field, if needed). The
loop is repeated up to 20 times (the limit is for safety, to avoid an
infinite loop if there are problems), so this is the largest number of fields
enclosed in '"' that are checked. A-X1 in each iteration is the start of the
rest of the line. The logic does not deal with the case of '"' within fields
enclosed in '"'.

231. Shipping labels are created automatically with the picking tickets and
printed in FH. Here labels are created directly for specific customers and
orders.

232. For 4-week aging, current, future 1, etc. are 4-week periods rather than
calendar months, so must determine start of current period: if report run on
Fri-Sat-Sun, it is the following Monday; else preceding Monday. In JJ-A, the
following 4-week periods are calculated by adding 28 days to this date.

233. ** The loop CD43 calculates the cartons for the unallocated qty, if any
(to print extra labels, more than those from BINALLOC; in orig logic in ID
these are printed with no lot number, to be filled in by hand; here the lot
is known, since this is done during shipping, so it is printed). Both
HL-ACARTONS and HL-ALABELS are 0 when creating the HL record, so no need to
clear them when first accessing the order (same for BA-LABELS). This
simplifies logic, as there is no need to know whether the order was accessed
before. HL-ACARTONS is calculated every time the order is accessed, and
HL-ALABELS and BA-LABELS simply store the number already entered. ** There
are two main search loops, CD53 and CD63. The first is the primary search, by
lot. The second searches by product, and is invoked in two cases: when the
first one failed to find a carton and also there is unallocated qty, but the
lot entered is the same as those in BINALLOC; or when the lot entered is new,
and there is unallocated qty. If carton found, or not found because there is
no unallocated qty left (either because never was, or now exhausted), it
does not matter why the loop was invoked, and the message is the same, "too
many cartons"; if not found because the lot given is wrong, the message is
"product not found".

234.1. ** Serial number IF-LABNO is also used as key LA-NO. It is incremented
here just by 1 for shipping labels (for which IF-LABNO is incremented by the
number of labels later, in the BAR-LAB-x procedures, by calling
BAR-SET-SERIAL), otherwise by the number of labels. In both cases there is
only one LABELS record and its key is the first serial number. This is the
serial number of the first label; the printer automatically increments it. **
To simplify the logic and to allow for future uses, IF-LABNO is incremented
by the number of labels even for those labels where the serial number is not
printed, and for those that are used as shipping labels but may also be
created as regular labels. In these cases some serial numbers are "wasted".
** See also BAR-QSER for cases where several labels are needed for each
serial number. When more than 4, BAR-LAB divides the one label into separate
labels for the printer, one for each serial number, in order to insert a
blank label between them (for ease of use) -- in effect forgoing the QSER
printer feature; but the total serial number range previously reserved does
not change.

234.2. ** The number of labels passed in A-N1 is sometimes BAR-LABQTY, and in
this case, if BAR-QSER>1, the number is 2, 3, etc. times greater than the
range of serial numbers needed, so some serial numbers are "wasted" (IF-LABNO
is incremented too much). Not worth adding logic to check for this: it is
relatively rare (mostly for master labels with A-N1=2), harmless, and would
require a separate procedure, since this one may be used before BAR-QSER is
set. ** BAR-CHK-SERIAL: IF-LABNO has 8 digits, but looks better on labels if
always 7 digits, so when it approaches 9,999,999 (when 10,000 left, since a
call may be for many labels, with serial number incremented by the printer)
it is reset to just over 1,000,000. It grows about 100,000/mth, so it is
reset every 9 years. There is no danger of duplication, since the requirement
is usually for no duplication to the same destination within one year.

235. In parts with cat=243 (roll thread dies), LIFE is not thousands of
pieces made, but thousands of lbs of product made. ADJ-PLIFE converts a qty
given in M pieces into equivalent weight in M lbs, so that PH-LIFE can be
used with the result the same way in either case. Can also be used to convert
similarly a dollar value/M pieces (this is why it uses A-T1 rather A-N1).

236. Since the selection criterion is that the AUTOSORT entries (not the
DEFECT ones) are in the date range, the number of M.O.s and the total for a
certain range may be smaller than the sum of the totals for, say, two halves
of that range -- because an M.O. may have AUTOSORT entries in both halves, so
the DEFECT entries will be counted in both. Also, the total reflects ALL the
DEFECT entries for an M.O., while only one AUTOSORT entry needs to be in the
range to select the M.O. So, in general, this inquiry is meant for large
ranges, where these problems (which may occur only at the start and end of
the range) form a small fraction of the total.

237. The condition DA-DESC(1:DA-LTH2) <= DA-DESC2 (rather than simply DA-DESC
<= DA-DESC2) is needed so that DESC2 can be just the beginning of a
description, like DESC1. The selection must include all the descriptions that
start with DESC2.

238. The contribution calculations are similar to AS reports, but here it
uses simply the most recent history period for each product, rather than a
specified period (so the period number CU-NUM may be different for each
product), and does not verify that the machine in the history period is the
same as the current machine; so the results may not be as accurate as in AS.

239.1. ** For customers who do not send 862's (AB-KDY=1), use the 830 data to
update DAYREL too, but only when automatic extensions must be generated in
LG (they are generated from DAYREL data); so MGM, GRAH, FAB, MOD are not
included, although they do not send 862's. ** For SKF, no DAYREL is created
in AC, although they do send 862's; so they are treated here as if not
sending 862's. ** For RBW, DAYREL pairs are created in 850 processing, but no
MATREL pairs, so treat it here as if they are sending 862's. But in places
where MATREL pairs are read and added to outstanding orders (BI, BB, KL,
etc.), also read DAYREL pairs, but only for RBW (see CHK-RBW) -- to avoid
duplication of qties when both DAYREL and MATREL refer to the same days
(current week).

239.2. See note 239.1 re:RBW. Cannot use DY-TYPE=8 as condition, because
there are several records in the system with type 8 and different plants.

239.3. ** Include RBW (see notes 239.1, 239.2, but use DY-TYPE to check,
since it is simpler and here it does not matter whether the others are
included) as in other places, because they do not have MATREL; and GM and
AmAx because they are the only others that have legitimate DAYREL records --
any others are those created from MATREL records, which are irrelevant and
even wrong (showing pairs that were already shipped, because the record was
not yet re-created; or even old, obsolete records that should have been
deleted). ** Unlike BI, BB, KL, etc., where there must be no duplication of
qties, here it is acceptable, so for GM and AmAx some qties may be read from
both DAYREL and MATREL (e.g., current week). It is up to the export file
users to separate them (based on the blanket indicator D or F, or the dates).
They want the long-term forecast data, but also the daily data when
available.

240.1. ** AB-OP/IQ-OP determines whether the AB/IQ section was invoked with
ED-CHRY set, or ED-GMC set, or ED-TYPE=0 (for all others). When 0, must check
the list; if not found, ED-TYPE will remain 0, so MT-TYPE will be 0 and that
customer will be seen as non-EDI (e.g., in RM reports). This is the only use
of ED-TYPE here (the 830/DELFOR specs seem to be the same for all senders);
the logic simply reads and updates the plant-products found in the file,
without any checks against the customer record (which could be done when
performing CHK-PLORD). ** Compare only beginning of ED-SENDER-ID (e.g. first
9 or 10 characters) when sender id is known to be longer, and the rest is
uncertain (is perhaps variable, etc.): actual id for Flexalloy is
085761492FLEX, for Fabco it is 249780669WAO.

240.2. See note 240.1.

240.3. See note 240.1, but here it is AC-OP, DY-TYPE, etc.

241. Dana requires " ", not "-", within one of their part numbers (part
8-73-316). In PRODUCT, the generic has "-", but their part is an alternate,
which has " ", so perhaps the replacement here is unnecessary. Everywhere
else (sales files, PLANT, MATREL, DAYREL, EDI 830 and 856) the alternate is
used, with " ", and this works, but it is not a good idea: only the generic
should be used, and the software would convert "-" to " " or vice-versa
everywhere (as done here for labels).

242. ** Select only those MNTLIN records added by the system in SU, for ISS
and ADJ maintenance transactions. Records with TYPE=1 (parts rather than
labour) are also added in AG (but their PART is blank) and in KC (but their
AMT is 0). So these records reflect correctly the required data; the only
potential problem is that users can delete records manually in KC, including
records created by the system (however, they cannot modify the amount in
these records). ** Very few records are actually found (only about 1% of
actual transactions), because users usually leave the maintenance order blank
in SU, and this bypasses the MNTLIN update; so the analysis and first grand
total are meaningless. There is a second part, scanning PARTRANS, which shows
the correct total; but no analysis is possible here, since the machine is
unknown.

243. In PART, qty fields are kept in lbs for materials and in number of units
for others (units can be "each", "lb", "litre", etc.); price fields are per
ton (2000 lbs) for materials and per 100 or 1000 units (depending on PH-MODE)
for others. DIV-PAMT converts a value adjusted according to the price mode,
into actual dollars; MUL-PAMT converts an actual dollar value into an
adjusted value. In PURLIN, qty fields are kept in tons for materials and in
number of units for others. DIV-MQTY and MUL-MQTY convert only materials,
DIV-SAMT and MUL-SAMT convert all but materials. PH-RECORD must be in memory,
and PART-TYPE must be executed, before calling these procedures, except
DIV-SAMT and MUL-SAMT, which use general values, set before call.

244.1. Export report lines as tab-delimited fields. ** EXP-LINE subtracts 1
from EXP-SZ in order to delete the tab that follows the last field on the
line, and which would likely look like an extra, empty column to the PC
program that reads the file. But EXP-SZ can be 0, if somehow no fields were
created, resulting in an empty line; so must check for this. ** For a blank
alpha value the field length in EXPF must be specifically set to 0 (since
leading " " in this case is 50, and the calculation would yield negative
field length), resulting in an empty field and consecutive tabs; numeric
values are at least one character long. ** EXP-HEADLN calculates EXP-RECORD
length directly, since STR-LTH works only up to 200 characters (A-A1 and
LIB-S1 length), and the header lines can be much longer (over 400). This is
much slower, but is done only once (about 5 msec on a Vax 4100 for avg line).
** INSPECT EXP-RECORD is needed because cannot use tabs in the VALUE strings
of the HEADLN fields: if too many tabs are used, the line may exceed 250
positions even if the actual length in the COBOL source is much less (even
though the tabs are within a string, the compiler expands them as 8-space
columns, and it is the resulting length that it sees). ** EXP-N, EXP-L, etc.
have leading "-", for PC programs that cannot read numbers with "-" at the
end. ** EXPFN writes A-N1 consecutive tabs (empty fields).

244.2. "EXP-RECORD PIC X(xxx)" and "RECORD VARYING 0 TO xxx" must be the same
value as EXP-MAX "VALUE xxx".

245. ** BAR-SET-SUPPLIER must be called in both BAR-LAB and BAR-LAB-SHIP, i.e.
whenever a BAR-LAB-xx procedure that uses BAR-SUPPLIER is called.
BAR-LAB-GMSHIP and BAR-LAB-AMAX are the only ones called directly, but they
do not use BAR-SUPPLIER. It is also called for master labels, by setting
BAR-CUS appropriately, simply to keep these codes in only one place. ** TRW
has 3 customer records: the US one needs one supplier code, two Can ones need
another; see trw.inf. So for both regular and master label must set BAR-CUS
accordingly.

246. SP-FTABLE is an index for the order in which the accounts in SP-STABLE
must be listed.

247. ADD-TRAUD must be executed after TR-RECORD is added or modified, and
while TR-RECORD is in memory.

248. ** It is assumed that each M.O. appears only once in the MQ short
schedule table. ** The R-TMP fields have 2 decimals -- rounding is done only
when reading them later. One decimal is enough in these calculations, but
standard WD fields are used. ** Check for negative results in the final coil
calculations, since the earlier calculations may yield any values (users may
issue more or less than recommended by the system, may produce more or less
than ordered, etc.). ** The qty already produced must be calculated by
reading the worksheets. Cannot simply use R-QTY-PROD, because that is updated
only in BN, and the OB calculations must reflect the latest entries, created
first thing in the morning for the previous day, including night shift.

249. Original bin no. was X(6), and only those operations that handle raw
material bins (exclusively or along with other bins) were modified for X(8).
If a non-material bin is created as X(8), only the first 6 characters are
seen in reports, etc.

250. ** Use two separate WORKSHEET loops, to reduce the number of records
read: only processes 90-95, 845, 850 are needed, and there are many between
them; this is within the PRODORD loop, and the delay is noticeable when there
are many M.O.'s. ** The loops calculate the DM (defective material) qty minus
any qty accepted or scrapped. If not an entire M.O. is DM, the qty received
may be larger than the DM qty, so if result is negative make it 0 (it means
entire DM qty was accepted).

251. ** Set the operations table from the worksheet entries, but ignore
entries with a process that is not in the operations list. This table is used
later to get the next operation in the operations list by matching the last
one in this table with those in the list, so a process not in the list would
not match. For the same reason, PROC-XTYPE is used later when matching them,
since the actual process may not be the one in the list, and not even in the
same regular group, but in the extended group. ** The table is filled simply
in the order in which processes are found in the worksheets, read
chronologically, which is assumed to be as in the operations list (there is
no easy way to rearrange them to match the list). ** MAINTA is used to avoid
reading the M.O.s and worksheets several times later in the BB-IXR loop. One
MAINTA record is created for each M.O. For orders that have no M.O.s (i.e. a
sales order with a product that has no current production) an empty MAINTA
record is created (in order to generate one line for such an order in the
output file); when reading it later in the BB-IXR loop, this simply results
in 0's for all M.O.-related fields, since the empty BB-OPX table causes
BB-IXL=0, etc., and the condition "IF BB-IXO > 1 AND BB-OPER(BB-IXO) = 0"
generates one line without interfering with the normal BB-OPX entries.

252.1. DR-DATE was left as MMDDYY in records up to Dec 31 1997, and is in new
date format after that; it and DR-TIME are set, but not used anywhere now.

252.2. See note 252.1; DG-DATE and DG-TIME are the same.

253. ** The test KL-KDEM=0 at the end of the SORTFL loop (no records found)
is needed to create an M.O. even if there is no demand, which is done only
for cat 21; but there is no need to check for cat 21, since for the others if
there is no demand the whole product loop is bypassed by earlier test IF
KL-BQTY <= 0 GO KL3, so KL-KDEM cannot be 0. ** KL-KFIR is needed for cat 21
and the case of several passes through the loop (many sales orders in the
following 12 weeks, and hence several M.O. batches), to use for the first
batch DATE-P if later than DATE-R, to avoid an M.O. date too early. In this
case, the second M.O. batch date may be earlier than the first. It is too
complicated to recalculate DATE-P in each pass (subtract SR-F5 qty from total
demand similarly to TQTY, etc.).

254. ** The file is sent by the bank or by American Axle in CSV format
(comma-separated fields). Here it is only listed, and converted into a dummy
EDI 820 file, which can then be processed through JG (process GM remittance
advice). ** Ignore any invalid lines: first field is numeric, so if first few
characters are not, this must be the first line in the file (which has the
column descriptions); this also deals with any blank lines, etc.

255. ** It is assumed that each line has a different heat, so qties are never
added to an existing bin; i.e., there is no need to check for combination of
part, process, and heat identical to a previous line -- they are always
unique, even when the bin is repeated; but only the special bins ANN, CLN,
PAD may be repeated (and even then the combinations are different), so must
try bins ANN1, ANN2, etc. until finding an empty one. ** When several
messages are generated, only the last one is seen; in particular, a line with
both bin and material invalid, and both added by the system.

256.1. Cannot use 99, 9999, etc. to end, since this may be a valid value, or
users expect to end with Return.

256.2. See note 256.1.

256.3. See note 256.1.

256.4. See note 256.1.

257. Only one change per day can be added to the history file. If more than
one is done, only last one is kept; this also takes care of case where users
make a mistake in price change and modify it again immediately.

258.1. ** DSP-QWAIT: display "please wait" only when many records may have to
be skipped before displaying something, which would take several seconds. **
For op=1, the product entered may be either blank (in which case all for that
customer are selected) or a specific value (in which case only that one is
selected). Entering the beginning of a product number does not work -- it is
interpreted as invalid product and nothing is selected. For op=2, the same
logic applies to customers.

258.2. See note 258.1 (second part).

259. ** The longer fields LT-MECH-1, etc. are used instead of the LT-MECH
fields in the LT specs table for various purposes: xxx-1 and xxx-6 are used
for a list of five samples (xxx-1 values have more decimals), while normally
only one sample is stored); xxx-5 is used for a free-format description. As
far as the system is concerned, these are all free-format values, as are
LT-MECH, although operations like MECH-CONV expect correct decimal values. **
These values are entered by inspectors when creating a lot using the data
received from the product QA tests; they are for MTR's, and vary with the
lot. The equivalent fields in the product record (P-SMIN, P-SMAX, P-SUNIT)
are fixed and indicate the permissible ranges for these values.

260. ** There is no check to see if strings exceed the length of PRO-OPDESC.
The worst case is assumed, 13 strings x 12 characters = 156, and there is an
extra X(12) after the two X(72) lines to allow for this; but only the first
12 strings will be displayed (probably no list has more than 9). **
PRO-SPDESC overwrites the last 14 characters of the second PRO-OPDESC line,
on the assumption that no more than 10 strings were used, so the last 24
characters are blank.

261. The field "SAME AS LOT NO." is used to create a new, plated lot for a
previous lot where FINISH was BARE. This method is always used to enter
plated lots. The new lot is copied from the old one, then the fields that may
be different are cleared.

262. ** String procedures: STR-CONVAN converts a character to its numeric
code. STR-CONVNA converts a numeric code to a character. STR-BINREV replaces
the first A-N1 characters in A-A1 with 1's complement of their binary value
(this is used to sort fields in reverse alphabetic order). STR-LTH returns
(in A-N1) the length of A-A1 (ignoring trailing spaces). ** STR-NUM is one
byte, STR-BL and STR-BH are the low and high nibbles.

263. The M.O. line is always printed, so there are some M.O.s for which no
parts are printed, when the 20% check fails. To prevent this must perform all
calculations before printing the M.O. line (so must read PRODORD and PART
records in NI3), or store that line and print it only with the first part
printed.

264.1. If modifying the number of fields in the export file, modify also the
number of fields that are skipped in the loop.

264.2. See note 264.1.

264.3. See note 264.1, but here the fields are skipped in the subtotal
procedures and the grand totals.

265. PH-RECORD must be read before call so that PH-LDCOST has a valid value
when no PURHIST record is found. So even if no PART record exists (the
process-cleaning part, for example), initialize PH-RECORD, and PH-LDCOST will
be 0. PU-ALDCOST is the same as PH-LDCOST, so the procedure simply reads
either cost from PURHIST if found, even if the PART record exists.

266. There usually is no process-cleaning part (only PURHIST), so do not flag
this as error.

267. Product "H" is "handling charge". It has no price and is used with a
value in L-EXTA. There are no bins and it is not allocated. The program must
check for it in several places in IN, LV, and IR, in order to bypass the
regular logic and include it in the invoice.

268. ** Allows for case of M.O.s with more than one primary machine: each
REPFL record is for a particular combination of M.O. and machine. ** First
WORKSHEET loop is needed to find the date of the last primary machine entry,
taken to be the M.O.s close date (presumably this is when R-FIN was set to
1). If this date is not in range, the whole M.O. is ignored.

269.1. Do not change the field numbers, since they are used in the USERS
authorization table UN-CFLD. If a field number must change, scan USERS and
replace all instances of that field number with the new one; similarly if a
field number must be deleted.

269.2. See note 269.1, but here it is UN-PFLD table.

270. XM-F is for unusually large work fields that are never accessed at the
same time and hence can use the same memory area.

271. Make MN-SEL and MN-FUNC equal to the regular menu functions G4 and P36,
so as to use the regular user authorization tables.

272.1. LZ-FIELDS are used in LZ and LW.

272.2. LZ-A is used in LZ and LW.

273. ** In the previous loop, the option REWRITE SR-RECORD is needed only for
NY-OP=2 or 3; when 1, the key is unique (there is only one worksheet with a
certain machine, M.O., employee no. per shift). ** The next loop is needed
in order to add machines that were not added in the previous loop (because
not used in the period selected), so as to show them as "N/S" later in the
report.

274. Count number of pages and mark first record in each page to identify
pages later in the main loop. Ensure that a page ends only after a complete
group of records for one M.O. (only NY-OP=1 can have several records for one
M.O.). A page ends when vertical position exceeds 400 + 2700 points (max page
bottom is 3200). 400 is top line of table, 50 is table headings, 50 and 20
are line spacings, so if changing these values must change them here too.

275. ** AX-DT-INV permits the entry of 0 as date, but rejects invalid dates.
** AX-DT-VAL uses 0 as default, AX-DT-DEF uses the value of D-DATE (set
before call) as default. For these two procedures, D-PF must be set when a PF
key is expected instead of a valid date, in order to avoid calling D-CHKDT,
which would reject it. The value of D-PF indicates which keys are permitted,
i.e. for which ones the date returned in DATE0 may be 0 or invalid, since it
will not be used. D-PF is set to 0 when IFOP starts and within these
procedures, so for calls where it is not used it need not be set to 0. If
called when some PF keys are permitted but the user presses another PF key
(or tab or cursor keys, since all are enabled then), this is treated as if he
pressed Return and D-CHKDT is called. Currently only 3 PF keys and
combinations are possible, so if adding others must include them in this
logic.

276.1. INTMPORD, INAPTR are the files of Irvine Nuts, so they must be
identical to TMPORD, APTR. They are needed when accessing these files while
in the Irvine Fasteners directory.

276.2. See note 276.1.

277. The USN-KPRT condition is needed to prevent printing when tested by user
SYSTEM: everything can be executed normally, but without actually sending
anything to the printer. The print file can then be examined or downloaded.

278. MGM has no serial number field, but needs 2 labels/carton, so BAR-LABQTY
is doubled and BAR-QSER is set to 2 (before call), to make this consistent
with the other labels.

279. DATFL is a generic sequential file, used for any import or export
operations. Record length must not exceed 200, since A-A1 is 200 (for
STR-LTH, used in DAT-LINE). If more, must calculate length directly, as in
EXP-HEADLN.

280. Must deal with several possible situations: a product could be made on
only one or on several machines; a tool may be used in several places in a
tool list; a tool may be used in only one or in several tool lists for the
same product. So, in order to calculate the total qty made with a given tool,
add to the previous qty only the first time a particular machine-tool-product
combination is encountered, and ignore the others (which are then only tools
used more than once in the same tool list). The machine table SC-F15 is
needed (rather than including the machine in the key) because the total qty
must be for all the machines found for a tool-product combination.

281. ** LASF adds LAS-FLD to LAS-RECORD at current position and advances the
pointer. If the record size is exceeded, it adds the portion that fits,
writes the record, resets the pointer, and adds the remainder. ** STR$TRIM is
called directly, rather than through STR-LTH, both to avoid using A-A1 and
A-N1, which may be in use where LASF is called, and to allow LAS-FLD longer
than A-A1. LIB-S1 must be at least as long as LAS-FLD. ** INSPECT LAS-FLD
replaces the "`" characters used in strings (for convenience) with the PCL
escape character.

282. DSP-WAIT and IXTSV: After WRT, IXT and IXTSV hold the line number of the
"??" line (first line below the displayed area, see note 1). If setting IXT
to lines within the displayed area (when calling AX-xxx-R procedures, or when
accessing fields directly), must restore IXT (from the saved value IXTSV) if
later calling a procedure that assumes IXT is below the displayed area. This
applies now only to DSP-WAIT, hence "MOVE IXTSV TO IXT" here. The condition
IXTSV>IXT is meant to exclude the sections where the static display did not
use a RDxx procedure and WRT; IXTSV is then 2 (set in DSP-CLS before jumping
to a section) and IXT is >=2.

283. For QSER of 4 or more must insert a blank label between the groups of
labels with the same serial number (to help operator separate these groups),
so the printer feature (which increments automatically the serial number only
every QSER labels) cannot be used. The loop here increments the serial number
by 1 for each group and makes LABQTY = QSER.

284. Calculate PH-ALIFE (tool "actual" life) based on primary machine qties
in YTD + last year worksheets. (The date calculation and the test to skip
older worksheets in UPD-T23 loop is not really needed now, since only one
year back is kept in IFMAINT year-end update anyway.) Must set D-YY before
call (normally current year, but could be previous year if called from RL and
RL is run on Jan 1). Life is set to 0 for assemblies (TL-CAT = 1, 2, 3 --
assembled die, assembled punch, assembled pin); also set to 0 if the number
of tools consumed is 0 or negative. The qty calculated from worksheets is
approximate. One problem is M.O.s that straddle the start or end of the
period (year end or the date of the calculation): a worksheet qty (which is
primary machine) is entered before the period start while the final qty is
added to on-hand within the period (can be much later, when all processes
finished), or vice versa at period end. The alternative (calculating life
from qty sold YTD, P-HAND, P-BEG-HAND(2)) is even less accurate.

285.1. EL-SWRITE is used instead of EL-WRITE in the INTO-RECORD definition
when the ED-SEP value may be other than "~": ED-SEP is set then as required,
but otherwise "~" can be used as usual, so no other changes are needed.

285.2. See note 285.1.

285.3. See note 285.1.

286. MECH-CONV converts the alpha value in MEC-VAL into the equivalent MPA
units (rounded to integer) and inserts this in MEC-VAL following the present
value. MEC-VAL must depict a number, with or without decimals. Example:
"12.345" becomes "12.345 - 85 MPA".

287.1. The time in the key ensures key uniqueness if the other key fields are
identical. But if such records are added in quick succession, must ensure
that the time separation is at least 10 msec, else the WRITE would fail and
display the "duplicate key" message (on current Vax 4100 it is 25+ msec).

287.2. See note 287.1.

287.3. See note 287.1.

288. LAS-BAR prints a code 39 barcode on laser printers. The current cursor
position becomes the top left corner of the barcode, and is restored before
returning. Set before call: A-A1 = value to print, LAS-BARH = bar height (in
PCL points), LAS-BARX = x dimension (width of narrow bar, in PCL points),
LAS-BARV = 0/1 for horizontal/vertical barcode. The ratio of wide to narrow
bars is fixed at 3 (see "MOVE 3 TO LAS-BARC"). Invalid characters (not in
LAS-BAR39 table) are printed as spaces.


