[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

3609.0. "prog to calculate cost of sending message?" by MSAM03::HOSOKEHUN () Wed Dec 01 1993 01:23

    Hi,
    
    I am looking for a tool to perform some simple costing exercise. If
    someone has something similar writtenned, would appreciate it if u can
    share the code.
    
    The tool: to tell me approximately how much a particular memo in a
    folder is going to cost me if I send out the memo.
    For example, after I created a mail and before I send it off, I should
    be able to issue an instruction which will then display the cost of
    this message. ie; if the company has to pay x dollars for 100bytes,
    then if this meesage is 500 bytes, then I will see the following
    message 'your message will cost (5*x) dollars.'
    
    
    Thanks in advance,
    Angeline
T.RTitleUserPersonal
Name
DateLines
3609.2GIDDAY::JOYCEOkay, who moved the goalposts?Thu Dec 09 1993 23:5420
    
    Seriously, try something like...
    
    ;;OA$_MO_SEND;;
    
    GET #BLOCKS = FILE$.BLOCK_SIZE[OA$CURMES_FILE]\
    COMPUTE #COST = #BLOCKS * <cost_per_block> \
    OA$FAO "This message is !AS blocks and will cost !AS dollars - send it ? " 
     "#PROMPT",#BLOCKS,#COST \
    YESNO_PROMPT #PROMPT\
    OA$FLD_STAY\
    .IF OA$PROMPT_TEXT = OA$Y THEN MAIL SEND
     ELSE DISPLAY("Message not sent")
    
    I haven't tested this and of course there are lot's of ways to send
    mail from ALL-IN-1 so you'd have to change all of them.  Maybe you
    should just implement a "Check cost" option instead?
    
    Andy
    
3609.3A suggestion to slightly improve on the code perhapsGIDDAY::SETHIRecompense injury with justiceFri Dec 10 1993 00:3418
    Hi Andy,
         
    A slight correction, since I am in my nit picking mood :-).
    
    >COMPUTE #COST = #BLOCKS * <cost_per_block> \
    
    I would perhaps create a logical that would have the cost per block,
    than do the following:
    
    get oa$dcl='#cost_per_block=f$trnlnm("logical name")'
    >COMPUTE #COST = #BLOCKS * #cost_per_block
    
    So if the price does change you do not have to go around hacking the
    code.  As an alternative the cost could be setup in OAINI.SCP.
    
    Regards,
    
    Sunil
3609.4GIDDAY::JOYCEOkay, who moved the goalposts?Fri Dec 10 1993 04:1022
    
    re .-1
    
>>    get oa$dcl='#cost_per_block=f$trnlnm("logical name")'
>>    >COMPUTE #COST = #BLOCKS * #cost_per_block
    
    This won't work - you can't set up a #symbol from DCL like this. 
    You've also got a > when you should have a \
    
    Try
    
    	GET #COST_PER_BLOCK = LOG$logical-name
    	\COMPUTE #COST = #BLOCKS * #COST_PER_BLOCK
    
    
    Or better, create yourself a system-wide dataset with 1 record...
       
    	GET #COST_PER_BLOCK = SYSCOSTS.VALUE["COST_PER_BLOCK"]
        \COMPUTE #COST = #BLOCKS * #COST_PER_BLOCK
        
    There's numerous other ways to do it...