Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control email genration...

Status
Not open for further replies.

eyetry

Programmer
Oct 2, 2002
560
US
I have a system that evaluates 997 acknowledgments and generates various emails depending on a predefined set of variables. I thought it was working fine until I ran into a 997 with multiple ST loops. Apparently I'm generationg one email per ST. My main condition is simple.. If the transaction is accepted, only notify receiver as required. Any other condition in AK501 and the Sender is always notified (as well as certain people in my firms respective departments).

How do I have my map wait until the entire 997 is processed before generating the email? I'm looking for something simple.

My experience with the product is slightly more than modest and we are using 6.0

 
The number of emails that you send per 'unit' of input will depend upon the structure of your output card type tree, and/or the Fetch mode of your input card.

If the input card is in Integral mode then all of the input data will be read before any output is built (so you will read all of your multiple ST loops before you start provided your input tree allows it). If this is the case, then as long as the output card that you are using to generate the email is creating output within a single object (rather than a group) then you will only generate one email.

If the input card is in Burst mode, then it is possible for output to be built for each unit of input (according to the fetch unit setting), which would lead to multiple emails.

The solution (I think, and I'm working a bit blind here!) is to ensure that the data is read in integral mode, and then have an output card with a single object in it, and then use a PUT command to generate the email. (I've been told that PUT commands in map rules are less effecient, but in practice I've not noticed any difference, especially with things like the email adapter, where you are usually more constrained by the speed of the email host).

 
Thanks for the quick response. I checked a few things out. Here's what I found:

All of the inputs are 'FetchAs Integral'. Below's a sample rule I'm using. Essentially the email data is built in the originating map. This map then forwards three inputs to the GenericEmail map; 997 as the email body, email sender receiver information and a remark line. The email map uses our customer rep as the sender (rep gets BCC'd) and builds in their custom signature and disclosure statement.

=If (TSAck'tCd Element:.:Input = "A",
PUT ("FILE", "m://PostOffice/Archive/997OK/"
+ New_Name Fields:.:FileName,
PACKAGE ( 997Ack )) +
If ( Notify_Sender Router_Elements Elements:TradingPartnerRecord = "A",
Forward_Ack(TradingPartnerRecord, FileName, 997Ack, EmailRemark)),
PUT ("FILE", "m://PostOffice/Archive/997Failed/"
+ "F_" + New_Name Fields:.:FileName,
PACKAGE ( 997Ack )) +
VALID(RUN("GenericEmail",Echoin(1,(PACKAGE(997Ack)))+
Echoin(2,package(TradingPartnerRecord))+
Echoin(4,package(EmailRemark))),
FAIL ( "Failure on RUN (" + TEXT ( LASTERRORCODE ( ) ) + "):" + LASTERRORMSG ( ) ) ) )

This rule is in the last output card of the originating map. TradingPartnerRecord, FileName, 997Ack and EmailRemark are also output cards. The only funtional map in this map is executed if the 997 indicates accepted.

Looking forward to response
 
If this rule is in a single object field (and I'm guessing that it probably is) then it will only be calling the Generic Email map once. You can check this my checking the Execution Audit logs.

I think the problem is with the Generic Email map. It looks as if your generic email map is building one email for each part of the multi-part 997Ack. This will be down to the type tree structure of the Output card which builds the email. I am guessing that the structure is something like this;

Input Output

997Ack BuildEmail
| |
---997Ack_part(1:s) ---BuildEmailRule(s)

If the BuildEmailRule contains a PUT or RUN statement, which has a mapping from the 997Ack_part object then the PUT or RUN will be invoked for each part of the 997Ack.

What you need to do is make sure that this output card only builds one object each time it is run. You can use a functional map on the output card to extract the data from the appropriate part of the multipart 997Ack. The rule might be something like;

=PUT("EMAIL"
, <Target Adapter Command>
, f_BuildMailOutput(997Ack,<Other Input Bits>)
)

The functional map f_BuildMailOutput takes the whole 997Ack irrespective of how many parts it has.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top