EDI404SD OCL
The provided document, EDI404SD.ocl36.txt
, is an Operation Control Language (OCL) program for IBM midrange systems (e.g., AS/400 or IBM i). It is called as part of the EDI (Electronic Data Interchange) outbound Bill of Lading (BOL) tracking maintenance workflow, specifically following the EDI811
program (as seen in EDI811.ocl36.txt
). The EDI404SD
OCL program manages the final steps of processing and transmitting EDI 404-compliant BOL data, including checking for records, running validation and FTP processes, and archiving data. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called, integrating context from the related EDI811P
and EDI811
programs.
Process Steps of the EDI404SD OCL Program¶
The EDI404SD
OCL program checks for the presence of EDI records, calls programs to validate and transmit them, copies records to a history file, and clears the source file. Here’s a detailed breakdown of the process steps:
- Header and Initial Setup:
- The program begins with a comment: "CHECK FOR RECORDS IN EDIBOL IF EMPTY THEN THERE IS NO NEED TO RUN THE OPTION." This suggests the program verifies whether there are records to process before proceeding.
-
// SCPROCP ,,,,,,,,?9?
: Defines the procedure name (SCPROCP
) with a parameter placeholder (?9?
, likely a library or system prefix). -
Check for Records in EDIRSI:
// IF ?F'A,?9?EDIRSI'?/0 PAUSE 'THERE ARE NO RECORDS TO SEND TO RSI. PRESS 0 TO CANCEL'
: Checks if theEDIRSI
file (labeled?9?EDIRSI
) has zero records (?F'A,...'?/0
). If true, it pauses the job and displays a message prompting the user to press 0 to cancel.// IF ?F'A,?9?EDIRSI'?/0 CANCEL
: IfEDIRSI
is empty, the program cancels execution, halting further processing.-
Purpose: Ensures the program only proceeds if there are records to process, avoiding unnecessary execution.
-
Call EDI404 Program:
CALL EDI404
: Calls theEDI404
program, likely an RPG or CL program that validates or processes the EDI 404 records inEDIOUT
orEDIRSI
(generated byEDI811
).// IF ?L'100,6'?/CANCEL CLRPF ?9?EDI404
: If theEDI404
program sets a condition at offset 100, length 6 toCANCEL
, theEDI404
file (labeled?9?EDI404
) is cleared using theCLRPF
(Clear Physical File) command.// IF ?L'100,6'?/CANCEL GOTO END
: If theCANCEL
condition is met, the program jumps to theEND
tag, terminating execution.-
Purpose: Validates or finalizes EDI 404 records before transmission, with a cancellation check to handle errors or user termination.
-
Call EDI404FTP Program:
CALL EDI404FTP
: Calls theEDI404FTP
program, which handles the FTP transmission of theEDIOUT
file (containing EDI 404 records) to an external trading partner, such as RSI (Railway Systems Inc., inferred from the file nameEDIRSI
).-
Purpose: Transmits the EDI 404 data to the recipient, completing the outbound BOL process.
-
Copy EDIRSI to History File:
CPYF FROMFILE(QS36F/?9?EDIRSI) TOFILE(QS36F/?9?EDIRSIH) MBROPT(*ADD) FMTOPT(*NOCHK)
: Copies records from theEDIRSI
file (in libraryQS36F
with prefix?9?
) to a history fileEDIRSIH
(same library and prefix).MBROPT(*ADD)
: Adds records to the target file without replacing existing ones.FMTOPT(*NOCHK)
: Bypasses format checking, ensuring a direct copy regardless of minor format differences.
-
Purpose: Archives
EDIRSI
records for historical or audit purposes before clearing the source file. -
Clear EDIRSI File:
CLRPF ?9?EDIRSI
: Clears theEDIRSI
file (labeled?9?EDIRSI
) to remove processed records, preparing it for the next job.-
Purpose: Ensures no residual data remains in
EDIRSI
, preventing duplicate processing in future runs. -
Program Termination:
// TAG END
: Marks theEND
label, reached after cancellation or normal processing.// LOCAL BLANK-*ALL
: Clears all local variables, ensuring a clean exit.
Business Rules¶
The EDI404SD
OCL program enforces the following business rules:
1. Record Existence Check:
- The program only proceeds if the EDIRSI
file contains records. If empty, it prompts the user to cancel and terminates execution, preventing unnecessary processing.
2. Validation Before Transmission:
- The EDI404
program is called to validate or finalize EDI 404 records before FTP transmission. If it signals cancellation (via a data area at offset 100, length 6), the EDI404
file is cleared, and the program ends.
3. Data Transmission:
- The EDI404FTP
program transmits EDI 404 records (likely in EDIOUT
) to an external trading partner, ensuring timely delivery of BOL data.
4. Data Archiving:
- Records in EDIRSI
are copied to EDIRSIH
for historical retention before clearing the source file, maintaining an audit trail.
5. File Management:
- The EDIRSI
file is cleared after archiving to prevent duplicate processing in subsequent runs.
- The EDI404
file is cleared if the EDI404
program cancels, ensuring no invalid data persists.
6. Environment Cleanup:
- Local variables are cleared at the end to prevent data leakage or conflicts in future jobs.
Tables (Files) Used¶
The OCL program references the following files:
1. EDIRSI:
- Label: ?9?EDIRSI
(in library QS36F
).
- Purpose: Input file containing routing or shipment information (generated by EDI811
), checked for records and cleared after archiving.
2. EDIRSIH:
- Label: ?9?EDIRSIH
(in library QS36F
).
- Purpose: Output file for archiving EDIRSI
records, used for historical or audit purposes.
3. EDI404:
- Label: ?9?EDI404
(in library QS36F
).
- Purpose: Likely the same as EDIOUT
(from EDI811
), containing EDI 404-compliant BOL records. Cleared if the EDI404
program cancels.
Note: The comment references EDIBOL
, but it’s not used directly in this OCL program. It likely refers to the workflow context where EDIBOL
is an input to EDI811
.
External Programs Called¶
The OCL program explicitly calls the following external programs:
1. EDI404:
- Called via CALL EDI404
.
- Purpose: Validates or finalizes EDI 404 records in EDIOUT
or EDIRSI
before transmission. It may set a cancellation condition checked at offset 100, length 6.
2. EDI404FTP:
- Called via CALL EDI404FTP
.
- Purpose: Handles FTP transmission of the EDIOUT
file (EDI 404 records) to an external trading partner, such as RSI.
Integration with EDI811P and EDI811 Programs¶
- EDI811P (OCL and RPG):
- The
EDI811P.rpg36
program validates company numbers (KYCO
) and BOL numbers, writing them toEDIBOL
. EDI811P.ocl36
sets up the initial files (BICONT
,EDIBOL
,EDIBOLTX
) and callsEDI811
.- EDI811 (OCL and RPG):
- The
EDI811.rpg36
program readsEDIBOL
andEDIBOLTX
, generating EDI 404 records inEDIOUT
and routing/shipment data inEDIRSI
. - The
EDI811.ocl36
program defines these files and callsEDI404SD
afterEDI811
completes. - EDI404SD:
- Checks
EDIRSI
for records, callsEDI404
for validation, transmits data viaEDI404FTP
, archivesEDIRSI
toEDIRSIH
, and clearsEDIRSI
. - The
EDI404
file (likelyEDIOUT
) is cleared if validation fails, ensuring data integrity. - Workflow Continuity:
EDI811P
prepares validated BOL data (EDIBOL
).EDI811
formats it into EDI 404 records (EDIOUT
,EDIRSI
).EDI404SD
validates, transmits, and archives the data, completing the outbound BOL process.
Summary¶
- Process Overview: The
EDI404SD
OCL program checks ifEDIRSI
contains records, cancels if empty, callsEDI404
to validate EDI 404 data, callsEDI404FTP
to transmit the data, copiesEDIRSI
toEDIRSIH
for archiving, and clearsEDIRSI
. It ensures a clean exit by clearing local variables. - Business Rules: Requires non-empty
EDIRSI
, validates data before transmission, archives records, clears files to prevent duplicates, and handles cancellation scenarios. - Tables/Files:
EDIRSI
(input),EDIRSIH
(output/history),EDI404
(output, likelyEDIOUT
). - External Programs:
EDI404
(validation),EDI404FTP
(FTP transmission).
If you need further details (e.g., the RPG/CL code for EDI404
or EDI404FTP
), please provide additional files or context.