BB600 OCL
The BB600.ocl36.txt
OCL program is a comprehensive Operation Control Language (OCL) script for an IBM System/36 or AS/400 environment, serving as the main control program for the invoice posting workflow. It orchestrates a series of steps to process invoice batches, manage EDI (Electronic Data Interchange) files, print registers, post sales analysis transactions, and clean up temporary files. Below is a detailed explanation of the process steps, business rules, external programs called, and tables (files) used.
Process Steps of the BB600 OCL Program¶
The BB600.ocl36.txt
OCL program coordinates multiple tasks in the invoice posting process, invoking several RPG and OCL programs, managing EDI files, and performing file maintenance. The steps are as follows:
- Wait for EDISNDCK Process:
- The program checks if the
EDISNDCK
job is active (IF ACTIVE-'EDISNDCK'
). - If active, it waits for 15 seconds (
WAIT INTERVAL-000015
) and loops back to theTRYAGN
tag to check again. -
This ensures that no conflicting EDI send processes are running before proceeding.
-
Create JEREMY Table for Order Sync Protection:
- The
// IFF DATAF1-?9?JEREMY BLDFILE ?9?JEREMY,S,RECORDS,999000,10,,T,,,NDFILE
statement checks if theJEREMY
file exists. If it does not, it creates a temporary file (?9?JEREMY
) with a capacity of 999,000 records, 10 bytes per record, and typeT
(temporary). -
This file is used to prevent order synchronization during invoice posting, as noted in the comments.
-
Invoke BB630 for Sales Journal Update:
-
The
// BB630 ,,,,,,,,?9?
statement calls theBB630
OCL program (likelyBB630.ocl36.txt
), which executes theBB630
RPG program to update the Sales Journal number (ACSLJ#
) in theARCONT
file for company number10
. -
Set System Attributes and Date Handling:
- The
// GSY2K
statement enables Year 2000-compliant date handling for proper processing of two-digit year formats. -
The
// ATTR CANCEL-NO,INQUIRY-YES
statement sets the job attributes to prevent cancellation (CANCEL-NO
) and allow inquiry (INQUIRY-YES
). -
Process EDI 810 Documents:
- Check for EDI 810 Data:
- The
// IFF DATAF1-?9?EDOT?20? GOTO JUMP
statement checks if the batch-specific EDI output file (?9?EDOT?20?
) exists. If not, it skips to theJUMP
tag, bypassing EDI 810 processing.
- The
- Run BB513:
- The
// LOAD BB513
block loads and executes theBB513
RPG program, opening: EDIOUT
(?9?EDOT?20?
, shared access): Temporary EDI work file.EDI810
(?9?EDI810
, shared access): Permanent EDI invoice file.BB513
copies records fromEDIOUT
toEDI810
for EDI 810 invoice transmission.
- The
- Run BB514:
- The
// BB514 ,,,,,,,,?9?
statement calls theBB514
OCL program, which executes theBB514
RPG program to combineFIL855
(EDI 855 purchase order acknowledgments) andEDI810
(EDI 810 invoices) intoEDISEND
for transmission to Kleinschmidt.
- The
-
Run BB517:
- The
// LOAD BB517
block loads and executes theBB517
RPG program, opening: EDIOTH
(?9?EDOTH?20?
, shared access): Temporary EDI invoice header file.EDIINVH
(?9?EDIINVH
, shared access): Permanent EDI invoice header file.EDIDPIH
(?9?EDIDPIH
, shared access): Duplicate EDI invoice header file.BB517
processesEDIOTH
records, adding new records toEDIINVH
, copying duplicates toEDIDPIH
, and logging duplicates to a printer file.
- The
-
Process EDI 945 Documents:
- Check for EDI 945 Data:
- The
// IFF DATAF1-?9?EDWSA?20? GOTO JUMP1
statement checks if the batch-specific EDI warehouse shipping advice file (?9?EDWSA?20?
) exists. If not, it skips to theJUMP1
tag, bypassing EDI 945 processing.
- The
-
Run BB516:
- The
// BB516 ,,,,,,,,?9?,,,,,,,,,,,?20?
statement calls theBB516
OCL program, which executes theBB516
RPG program to copy records fromEDWSA
(?9?EDWSA?20?
) toEDI945
(?9?EDI945
) for EDI 945 warehouse shipping advice transmission.
- The
-
Print Registers:
- The
// SWITCH 1XXXXXXX
statement sets switch 1 to suppress the gross profit report. - The
// LOAD BB600
block loads and executes theBB600
RPG program (not to be confused with this OCL program), opening:INVTOT
(?9?BBTT?20?
): Invoice totals file.BBTRAN
(?9?BBTR?20?
): Invoice transaction file.BICONT
(?9?BICONT
, shared access): Billing control file.ARCUST
(?9?ARCUST
, shared access): A/R customer file.- Printer files:
LIST
,LIST2
,MILIST
(deviceP5
, priority 0),MILISTP1
(deviceP1
, priority 0).
- Conditional printer overrides for the
REPORT
file based on the?9?
environment variable:- If
?9? = G
,OVRPRTF FILE(REPORT) OUTQ(QUSRSYS/SJPOST)
. - If
?9? = G
and another condition,OVRPRTF FILE(REPORT) OUTQ(QUSRSYS/TESTOUTQ)
.
- If
- The
BB600
RPG program likely prints invoice registers or reports using these files. -
The
// SWITCH 0XXXXXXX
statement resets switch 1 after execution. -
Post Sales Analysis Transactions:
- The
// LOAD BB605
block loads and executes theBB605
RPG program, opening multiple files:SA5TRN
(?9?BBSA?20?
): Sales analysis transaction file.SA5TSH
(?9?BBSS?20?
): Sales analysis transaction header file.SHPADR
(?9?SHPADR
, shared access): Ship-to address file.SA5FILD
,SA5FILM
,SA5DBBD
,SA5DBBM
,SA5BCMD
,SA5BCMM
,SA5COPD
,SA5COPM
,SA5SHA
(?9?
prefix, shared access): Various sales analysis files.BBIBCH
,BBIBCHX
(?9?
prefix, shared access): Invoice batch header files.BBTRA1
,BBTRANU
(?9?BBTR?20?
),BBTRTX
(?9?BBTX?20?
): Additional transaction files.
-
BB605
likely processes sales analysis data, updating relevant files based on invoice transactions. -
Reorganize and Delete Transaction Files:
- The
// IFF ?F'A,?9?BBTR?20?'?/0 RGZPFM FILE(?9?BBTR?20?)
statement reorganizes theBBTR?20?
file if it exists and is empty. - The
// IFF ?F'A,?9?BBTX?20?'?/0 RGZPFM FILE(?9?BBTX?20?)
statement reorganizes theBBTX?20?
file if it exists and is empty. - Conditional deletion of files if both
BBTR?20?
andBBTX?20?
are empty:GSDELETE BBTX?20?,,,,,,,,?9?
GSDELETE BBTR?20?@,,,,,,,,?9?
GSDELETE BBTR?20?,,,,,,,,?9?
-
This cleans up empty transaction files to free up space.
-
Copy Electronic Invoices to Permanent File:
- The
// IF ?F'A,?9?BBEIP?20?'?/00000000 GOTO JUMP2
statement checks if the batch-specific electronic invoice file (?9?BBEIP?20?
) is empty. If so, it skips to theJUMP2
tag. - Otherwise, the
CPYF FROMFILE(*LIBL/?9?BBEIP?20?) TOFILE(*LIBL/?9?SA5IVEI) MBROPT(*ADD) FMTOPT(*NOCHK)
statement copies records fromBBEIP?20?
toSA5IVEI
, adding records (MBROPT(*ADD)
) without format checking (FMTOPT(*NOCHK)
).
- The
-
Create Copies for Spoolflex (Advanced Shipping Notices and Invoices):
- For Advanced Shipping Notices (ASN) if
?13? = PP
and?9? = G
: - The
CALL PGM(BB6002ASN) PARM('?20?' '?9?')
statement calls theBB6002ASN
program, passing the batch number (?20?
) and library prefix (?9?
), to create copies of ASN data for Spoolflex (a system for splitting, copying, and distributing output). - For Invoices if
?9? = G
: - The
CALL PGM(BB6002NEW) PARM('?20?' '?9?')
statement calls theBB6002NEW
program, passing the same parameters, to create copies of invoice data for Spoolflex. - A commented-out call to
BB6002
suggests a legacy or alternative program for invoices, replaced byBB6002NEW
.
- For Advanced Shipping Notices (ASN) if
-
Delete Temporary and Transaction Files:
- A series of
// IF DATAF1-?9?XXXX?20? DELETE ?9?XXXX?20?,F1
statements deletes batch-specific temporary and transaction files if they exist: BBIN?20?
,BBRR?20?
,BBTT?20?
,BBSA?20?
,BBSS?20?
,BBCF?20?
,BBOK?20?
,BBKE?20?
,BBTL?20?
,ORIN?20?
,ORBB?20?
,OXBB?20?
,EDOT?20?
,EDOTH?20?
,BBEIP?20?
,JEREMY
.- This cleans up all batch-specific files after processing to free up disk space.
- A series of
-
Process Viscosity ASN Shipments:
- If
?13? = PP
(Viscosity Post), the// IF ?13?/PP BB607 ,,,,,,,,?9?
statement calls theBB607
OCL program, which likely processes or removes orders related to Viscosity ASN shipments. - This step is noted to be activated after the "PP Barcode Project" is active.
- If
-
Program Termination:
- The OCL program terminates after completing all steps, having processed invoices, EDI files, sales analysis data, and cleaned up temporary files.
Business Rules¶
- Process Synchronization:
-
The program waits for the
EDISNDCK
job to complete to avoid conflicts with EDI send processes, ensuring data integrity during invoice posting. -
Order Sync Protection:
-
The
JEREMY
file is created to prevent order synchronization during invoice posting, ensuring that invoice processing is isolated from order updates. -
EDI Processing:
- EDI 810 (invoices) and EDI 945 (warehouse shipping advice) files are processed only if their respective batch-specific files (
EDOT?20?
,EDWSA?20?
) exist. - Records are copied to permanent files (
EDI810
,EDI945
,EDIINVH
,SA5IVEI
) and duplicates are managed (EDIDPIH
). -
Files are archived (via
BB514
andBB516
) to maintain historical data for up to 20 versions. -
Sales Journal Update:
-
The Sales Journal number is updated for company
10
viaBB630
, ensuring unique journal entries for A/R posting. -
Reporting:
- Invoice registers are printed using
BB600
, with the gross profit report suppressed (switch 1). -
Output is directed to specific printer queues based on the environment (
?9? = G
). -
Sales Analysis:
-
Sales analysis transactions are posted to multiple files via
BB605
, ensuring accurate tracking of sales data. -
File Cleanup:
- Empty transaction files (
BBTR?20?
,BBTX?20?
) are reorganized and deleted if empty. - All batch-specific temporary files are deleted after processing to maintain system efficiency.
-
The
EDWSA
file is cleared after EDI 945 processing. -
Spoolflex Integration:
-
For Viscosity Post (
?13? = PP
), ASN and invoice data are prepared for Spoolflex distribution, ensuring copies are available for splitting and distribution. -
Conditional Processing:
- Many steps are conditional based on file existence (
DATAF1
) or environment variables (?9?
,?13?
), allowing flexibility for different configurations (e.g.,PP
for Viscosity Post,G
for specific output queues).
External Programs Called¶
- BB630:
-
OCL program that executes the
BB630
RPG program to update the Sales Journal number (ACSLJ#
) in theARCONT
file for company10
. -
BB513:
-
RPG program that copies records from
EDIOUT
toEDI810
for EDI 810 invoice processing. -
BB514:
-
OCL program that executes the
BB514
RPG program to combineFIL855
(EDI 855) andEDI810
(EDI 810) records intoEDISEND
for transmission to Kleinschmidt. -
BB517:
-
RPG program that processes
EDIOTH
records, adding new records toEDIINVH
, copying duplicates toEDIDPIH
, and logging duplicates to a printer file. -
BB516:
-
OCL program that executes the
BB516
RPG program to copyEDWSA
records toEDI945
for EDI 945 warehouse shipping advice transmission. -
BB600:
-
RPG program that prints invoice registers using
INVTOT
,BBTRAN
,BICONT
, andARCUST
, with output directed to multiple printer files. -
BB605:
-
RPG program that posts sales analysis transactions to multiple files (
SA5TRN
,SA5TSH
, etc.) for sales tracking. -
BB6002ASN:
-
Program called for Viscosity Post (
?13? = PP
) to create copies of Advanced Shipping Notices for Spoolflex distribution. -
BB6002NEW:
-
Program called to create copies of invoices for Spoolflex distribution, replacing a legacy
BB6002
program. -
BB607:
- OCL program called for Viscosity Post (
?13? = PP
) to process or remove orders related to Viscosity ASN shipments, activated post-PP Barcode Project.
- OCL program called for Viscosity Post (
Tables (Files) Used¶
- JEREMY:
- Temporary file created to prevent order synchronization (
?9?JEREMY
, 999,000 records, 10 bytes, typeT
). -
Deleted after processing.
-
ARCONT:
- Accounts Receivable control file (
?9?ARCONT
, shared access, used byBB630
). -
Stores Sales Journal number (
ACSLJ#
) and other A/R control data. -
EDIOUT:
- Temporary EDI work file (
?9?EDOT?20?
, shared access, used byBB513
). -
Copied to
EDI810
for invoice transmission. Deleted after processing. -
EDI810:
- Permanent EDI 810 invoice file (
?9?EDI810
, shared access, used byBB513
,BB514
). -
Archived to
BBIV01
–BBIV40
byBB514
. Cleared after processing. -
FIL855:
- EDI 855 purchase order acknowledgment file (
?9?FIL855
, shared access, used byBB514
). -
Archived to
BBPA01
–BBPA40
and cleared byBB514
. -
EDISEND:
- EDI send file (
EDISEND
or?9?EDISEND
, shared access, used byBB514
). -
Combines
FIL855
andEDI810
for transmission to Kleinschmidt. -
EDIOTH:
- Temporary EDI invoice header file (
?9?EDOTH?20?
, shared access, used byBB517
). -
Processed into
EDIINVH
orEDIDPIH
. Deleted after processing. -
EDIINVH:
- Permanent EDI invoice header file (
?9?EDIINVH
, shared access, used byBB517
). -
Stores unique EDI invoice header records.
-
EDIDPIH:
- Duplicate EDI invoice header file (
?9?EDIDPIH
, shared access, used byBB517
). -
Stores duplicate EDI invoice header records.
-
EDWSA:
- Batch-specific EDI 945 warehouse shipping advice file (
?9?EDWSA?20?
, shared access, used byBB516
). - Copied to
EDI945
and cleared after processing.
- Batch-specific EDI 945 warehouse shipping advice file (
-
EDI945:
- Permanent EDI 945 warehouse shipping advice file (
?9?EDI945
, shared access, used byBB516
). - Archived to
BBVA01
–BBVA40
byBB516
.
- Permanent EDI 945 warehouse shipping advice file (
-
INVTOT:
- Invoice totals file (
?9?BBTT?20?
, used byBB600
). - Deleted after processing.
- Invoice totals file (
-
BBTRAN:
- Invoice transaction file (
?9?BBTR?20?
, used byBB600
,BB605
). - Reorganized and deleted if empty.
- Invoice transaction file (
-
BICONT:
- Billing control file (
?9?BICONT
, shared access, used byBB600
).
- Billing control file (
-
ARCUST:
- A/R customer file (
?9?ARCUST
, shared access, used byBB600
).
- A/R customer file (
-
SA5TRN:
- Sales analysis transaction file (
?9?BBSA?20?
, used byBB605
). - Deleted after processing.
- Sales analysis transaction file (
-
SA5TSH:
- Sales analysis transaction header file (
?9?BBSS?20?
, used byBB605
). - Deleted after processing.
- Sales analysis transaction header file (
-
SHPADR, SA5FILD, SA5FILM, SA5DBBD, SA5DBBM, SA5BCMD, SA5BCMM, SA5COPD, SA5COPM, SA5SHA:
- Sales analysis files (
?9?
prefix, shared access, used byBB605
).
- Sales analysis files (
-
BBIBCH, BBIBCHX:
- Invoice batch header files (
?9?
prefix, shared access, used byBB605
).
- Invoice batch header files (
-
BBTRA1, BBTRANU, BBTRTX:
- Additional transaction files (
?9?BBTRA1
,?9?BBTR?20?
,?9?BBTX?20?
, used byBB605
). BBTR?20?
andBBTX?20?
are reorganized and deleted if empty.
- Additional transaction files (
-
BBEIP:
- Batch-specific electronic invoice file (
?9?BBEIP?20?
, used for copying toSA5IVEI
). - Deleted after processing.
- Batch-specific electronic invoice file (
-
SA5IVEI:
- Permanent electronic invoice file (
?9?SA5IVEI
, receives records fromBBEIP?20?
).
- Permanent electronic invoice file (
-
BBPA01 to BBPA40:
- Archive files for EDI 855 (
?9?
prefix, managed byBB514
).
- Archive files for EDI 855 (
-
BBIV01 to BBIV40:
- Archive files for EDI 810 (
?9?
prefix, managed byBB514
).
- Archive files for EDI 810 (
-
BBVA01 to BBVA40:
- Archive files for EDI 945 (
?9?
prefix, managed byBB516
).
- Archive files for EDI 945 (
-
BBIN?20?, BBRR?20?, BBCF?20?, BBOK?20?, BBKE?20?, BBTL?20?, ORIN?20?, ORBB?20?, OXBB?20?:
- Batch-specific temporary files (
?9?
prefix, deleted after processing).
- Batch-specific temporary files (
Summary¶
The BB600.ocl36.txt
OCL program is the main control script for the invoice posting workflow, coordinating:
- Waiting for EDI send process completion (EDISNDCK
).
- Creating a temporary file (JEREMY
) to prevent order synchronization.
- Updating the Sales Journal number via BB630
.
- Processing EDI 810 (BB513
, BB514
, BB517
) and EDI 945 (BB516
) files.
- Printing invoice registers via BB600
.
- Posting sales analysis transactions via BB605
.
- Copying electronic invoices to a permanent file.
- Creating ASN and invoice copies for Spoolflex (BB6002ASN
, BB6002NEW
).
- Cleaning up temporary and transaction files.
- Processing Viscosity ASN shipments via BB607
(if ?13? = PP
).
External Programs Called: BB630
, BB513
, BB514
, BB517
, BB516
, BB600
, BB605
, BB6002ASN
, BB6002NEW
, BB607
.
Tables Used: JEREMY
, ARCONT
, EDIOUT
, EDI810
, FIL855
, EDISEND
, EDIOTH
, EDIINVH
, EDIDPIH
, EDWSA
, EDI945
, INVTOT
, BBTRAN
, BICONT
, ARCUST
, SA5TRN
, SA5TSH
, SHPADR
, SA5FILD
, SA5FILM
, SA5DBBD
, SA5DBBM
, SA5BCMD
, SA5BCMM
, SA5COPD
, SA5COPM
, SA5SHA
, BBIBCH
, BBIBCHX
, BBTRA1
, BBTRANU
, BBTRTX
, BBEIP
, SA5IVEI
, BBPA01–BBPA40
, BBIV01–BBIV40
, BBVA01–BBVA40
, BBIN?20?
, BBRR?20?
, BBCF?20?
, BBOK?20?
, BBKE?20?
, BBTL?20?
, ORIN?20?
, ORBB?20?
, OXBB?20?
.
This program ensures a complete invoice posting process, integrating EDI transmission, reporting, sales analysis, and cleanup, with conditional logic for specific environments (e.g., Viscosity Post).