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
EDISNDCKjob is active (IF ACTIVE-'EDISNDCK'). - If active, it waits for 15 seconds (
WAIT INTERVAL-000015) and loops back to theTRYAGNtag 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,,,NDFILEstatement checks if theJEREMYfile 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 theBB630OCL program (likelyBB630.ocl36.txt), which executes theBB630RPG program to update the Sales Journal number (ACSLJ#) in theARCONTfile for company number10. -
Set System Attributes and Date Handling:
- The
// GSY2Kstatement enables Year 2000-compliant date handling for proper processing of two-digit year formats. -
The
// ATTR CANCEL-NO,INQUIRY-YESstatement 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 JUMPstatement checks if the batch-specific EDI output file (?9?EDOT?20?) exists. If not, it skips to theJUMPtag, bypassing EDI 810 processing.
- The
- Run BB513:
- The
// LOAD BB513block loads and executes theBB513RPG program, opening: EDIOUT(?9?EDOT?20?, shared access): Temporary EDI work file.EDI810(?9?EDI810, shared access): Permanent EDI invoice file.BB513copies records fromEDIOUTtoEDI810for EDI 810 invoice transmission.
- The
- Run BB514:
- The
// BB514 ,,,,,,,,?9?statement calls theBB514OCL program, which executes theBB514RPG program to combineFIL855(EDI 855 purchase order acknowledgments) andEDI810(EDI 810 invoices) intoEDISENDfor transmission to Kleinschmidt.
- The
-
Run BB517:
- The
// LOAD BB517block loads and executes theBB517RPG 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.BB517processesEDIOTHrecords, 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 JUMP1statement checks if the batch-specific EDI warehouse shipping advice file (?9?EDWSA?20?) exists. If not, it skips to theJUMP1tag, bypassing EDI 945 processing.
- The
-
Run BB516:
- The
// BB516 ,,,,,,,,?9?,,,,,,,,,,,?20?statement calls theBB516OCL program, which executes theBB516RPG program to copy records fromEDWSA(?9?EDWSA?20?) toEDI945(?9?EDI945) for EDI 945 warehouse shipping advice transmission.
- The
-
Print Registers:
- The
// SWITCH 1XXXXXXXstatement sets switch 1 to suppress the gross profit report. - The
// LOAD BB600block loads and executes theBB600RPG 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
REPORTfile based on the?9?environment variable:- If
?9? = G,OVRPRTF FILE(REPORT) OUTQ(QUSRSYS/SJPOST). - If
?9? = Gand another condition,OVRPRTF FILE(REPORT) OUTQ(QUSRSYS/TESTOUTQ).
- If
- The
BB600RPG program likely prints invoice registers or reports using these files. -
The
// SWITCH 0XXXXXXXstatement resets switch 1 after execution. -
Post Sales Analysis Transactions:
- The
// LOAD BB605block loads and executes theBB605RPG 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.
-
BB605likely 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 JUMP2statement checks if the batch-specific electronic invoice file (?9?BBEIP?20?) is empty. If so, it skips to theJUMP2tag. - 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? = PPand?9? = G: - The
CALL PGM(BB6002ASN) PARM('?20?' '?9?')statement calls theBB6002ASNprogram, 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 theBB6002NEWprogram, passing the same parameters, to create copies of invoice data for Spoolflex. - A commented-out call to
BB6002suggests 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?,F1statements 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 theBB607OCL 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
EDISNDCKjob to complete to avoid conflicts with EDI send processes, ensuring data integrity during invoice posting. -
Order Sync Protection:
-
The
JEREMYfile 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
BB514andBB516) to maintain historical data for up to 20 versions. -
Sales Journal Update:
-
The Sales Journal number is updated for company
10viaBB630, 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
EDWSAfile 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.,PPfor Viscosity Post,Gfor specific output queues).
External Programs Called¶
- BB630:
-
OCL program that executes the
BB630RPG program to update the Sales Journal number (ACSLJ#) in theARCONTfile for company10. -
BB513:
-
RPG program that copies records from
EDIOUTtoEDI810for EDI 810 invoice processing. -
BB514:
-
OCL program that executes the
BB514RPG program to combineFIL855(EDI 855) andEDI810(EDI 810) records intoEDISENDfor transmission to Kleinschmidt. -
BB517:
-
RPG program that processes
EDIOTHrecords, adding new records toEDIINVH, copying duplicates toEDIDPIH, and logging duplicates to a printer file. -
BB516:
-
OCL program that executes the
BB516RPG program to copyEDWSArecords toEDI945for 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
BB6002program. -
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
EDI810for invoice transmission. Deleted after processing. -
EDI810:
- Permanent EDI 810 invoice file (
?9?EDI810, shared access, used byBB513,BB514). -
Archived to
BBIV01–BBIV40byBB514. Cleared after processing. -
FIL855:
- EDI 855 purchase order acknowledgment file (
?9?FIL855, shared access, used byBB514). -
Archived to
BBPA01–BBPA40and cleared byBB514. -
EDISEND:
- EDI send file (
EDISENDor?9?EDISEND, shared access, used byBB514). -
Combines
FIL855andEDI810for transmission to Kleinschmidt. -
EDIOTH:
- Temporary EDI invoice header file (
?9?EDOTH?20?, shared access, used byBB517). -
Processed into
EDIINVHorEDIDPIH. 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
EDI945and 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–BBVA40byBB516.
- 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).