Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love this site! It's so nice to know that there are so many people out there who are willing to share their knowledge..."

Geography

Where in the world do Tek-Tips members come from?
eyetry (Programmer)
11 Nov 02 0:18
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

Willbert (Programmer)
11 Nov 02 15:26
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).

eyetry (Programmer)
11 Nov 02 16:59
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
Willbert (Programmer)
12 Nov 02 15:05
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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close