Problem solve Get help with specific problems with your technologies, process and projects.

Formatting the TOINTNET parameter

I have a CLP which calls an RPG program to format the recipient list, subject line and text of an e-mail message. Then, the RPG program passes this data back to the CLP, which uses it to build and execute the SNDDST command. If my recipient list contains more than one internet user ID, the e-mail address values get enclosed in quotes on the TOINTNET parameter of the SNDDST command. This causes the message to be non-deliverable. I've tried formatting the recipient list to where there are no embedded blanks. I've tried separating the e-mail addresses with a semi-colon. Also enclosing each address in parentheses, which is how it appears if I manually type the command and execute it. If I'm only sending the message to a single e-mail address, it works fine.

Does anyone have any idea how this TOINTNET parameter should be formatted? I think if I could just get the CLP to not enclose the passed address list in quotes, it would work.

When you try to execute a command in a CL program and that command has an unknown number of parameters, you usually have to execute that command using the QCMDEXC API. Following is a program that accepts a message and a message description. The program will then send that message to multiple e-mail addresses that are contained in a file by building the command in the CL program.

/*   ***********************************************************
/*   SEND E-MAIL TO MULTIPLE E-MAIL ADDRESSES                           
/*   ***********************************************************
             PGM        PARM(&MSG &DESC)                                
             DCLF       FILE(EMAILIDS)                                  
             DCL        VAR(&DESC) TYPE(*CHAR) LEN(20)                  
             DCL        VAR(&MSG) TYPE(*CHAR) LEN(20)                   
             DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(2500)   
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(2500)                 
             DCL        VAR(&BLANKSTR) TYPE(*CHAR) LEN(2500)            
/*  CLEAR OUT VARIABLES                                              */ 
             CHGVAR     VAR(&CMD) VALUE(&BLANKSTR)                      
/*  BUILD THE FIRST PART OF  THE COMMAND STRING                             */ 
             CHGVAR     VAR(&CMD) VALUE('SNDDST TYPE(*LMSG) +           
/*  ADD ALL E-MAIL ADDRESSES TO RECIPIENT LIST                       */ 
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(FINISH))        
             CHGVAR     VAR(&CMD) VALUE(&CMD *TCAT '(' *TCAT &NAME +    
                          *TCAT ') ')                                   
             GOTO READ                                                  
/*  CLOSE E-MAIL ADDRESS PARM                                           */ 
             CHGVAR     VAR(&CMD) VALUE(&CMD *TCAT ')')                 
             CHGVAR     VAR(&CMD) VALUE(&CMD *BCAT 'DSTD(' *TCAT +      
                          '''' *TCAT &DESC *TCAT '''' *TCAT ') ')       
             CHGVAR     VAR(&CMD) VALUE(&CMD *BCAT 'LONGMSG(' *TCAT +   
                          '''' *TCAT &MSG *TCAT '''' *TCAT ') ')        
/*  EXECUTE THE COMMAND                                            */   
             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)      
 ENDPGM:     ENDPGM     


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

This was last published in August 2001

Dig Deeper on iSeries CL programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.