SeanHoppe.com › Code Samples › Send email from CL job submitting CRTAPPDTA
Cleo CL & RPGLE: Send email from CL job submitting CRTAPPDTA
In the Cleo EDI Integrator example below we will describe the usage of a CL and RPG program with the Cleo formula, in a map, to use Cleo/EXTOL's Command EXENOTE.
Once we call CRTAPPDTA(B), we will query we will then call a program that will check the connection file for an error status. The file that you will want to check for the connection status codes is EXLLCRL1.
LCFSCR - Status code field that you will check.LCCWLW - this field contains the connection log number. If we know the Connection Log number when we query EXLLCRL1, then we will use this value to chain out to the correct record to check the correct status field.
LCJOB# - this field contains the job number of the submit job that calls CRTAPPDTA. If we do NOT know the Connection Log number when we query EXLLCRL1, then we will use this value to chain out to the correct record to check the correct status field. Possible codes in: LCFSCR
E - Trans Err
V - Unwrap Error
D - Duplicate
N - Unw-no EDI
M - Mixed
O - Rdy to gen
A - Added
I - Rcv error
U - Unwrapped
R - Received
T - Translated
S - Sent
Q - Env error
W - Wrapped
F - Send error
X - Wrap error
G - Generated
H - Gen error
L - Enveloped
P - Mark:purge
If you find one of these codes in the record you are checking, you will call EXENOTE in order to automate the sending of an e-mail. Here is an example of how to use EXENOTE...
PGM
/* Standard parameter list variables: */
DCL VAR(&ADDRESS) TYPE(*CHAR) LEN(132)
DCL VAR(&TONAME) TYPE(*CHAR) LEN(132)
DCL VAR(&ORIGINAT) TYPE(*CHAR) LEN(132)
DCL VAR(&FROMNAME) TYPE(*CHAR) LEN(132)
DCL VAR(&SUBJECT) TYPE(*CHAR) LEN(132)
DCL VAR(&MESSAGE) TYPE(*CHAR) LEN(132)
DCL VAR(&MESSAGE2) TYPE(*CHAR) LEN(132)
CHGVAR VAR(&ADDRESS) VALUE('TO-EMAIL.COM')
CHGVAR VAR(&TONAME) VALUE('TO PERSON NAME')
CHGVAR VAR(&ORIGINAT) VALUE('FROM-EMAIL.COM')
CHGVAR VAR(&FROMNAME) VALUE('FROM PERSON NAME')
CHGVAR VAR(&SUBJECT) VALUE('SUBJECT SHOWN ON EMAIL' )
CHGVAR VAR(&MESSAGE) VALUE('MESSAGE LINE1')
CHGVAR VAR(&MESSAGE2) VALUE('MESSAGE LINE2')
EXENOTE TOADR(&ADDRESS) TONAME(&TONAME)
FROMADR(&ORIGINAT) FROMNAME(&FROMNAME)
SUBJECT(&SUBJECT) MESSAGE(&MESSAGE)
MESSAGE2(&MESSAGE2)
ENDPGM: RCLRSC
ENDPGM
By: Sean Hoppe on