Ayuda con REXX para enviar e-mails

Temas relacionados al VSE
Responder
Avatar de Usuario
maiz2005
Colaborador
Colaborador
Mensajes: 182
Registrado: 14 Sep 2005, 17:51
País: España
Ciudad: Barcelona
Ocupación: System Programmer
Ubicación: Barcelona, España

Ayuda con REXX para enviar e-mails

Mensaje por maiz2005 » 22 Oct 2005, 14:33

Buenas a todos por aca, tengo un REXX que envia correos con archivos ATTACH de la cola de LST (VSE/POWER). el REXX envia bien el correo pero el problema que tengo es que cada dia tengo que estar borrando manualmente de la cola de LST los reportes que envia, para que al dia siguiente que el REXX corre no envie el listado mas antiguo.

con este lo ejecuto.. el listado que envia es el que se llama REPMALOJ que esta en la cola de LST con clase N.

* $$ JOB JNM=EMAIL,DISP=D,CLASS=4
// JOB EMAIL EMAIL A MARIO
* EXECUTING THE MEMBER
// LIBDEF *,SEARCH=(PRD3.TCPIP,PRD2.CONFIG)
// EXEC REXX=OOPSMAI4,PARM='MRE@IG.HN REPMALOJ N '
/*
/&
* $$ EOJ


Con este es que se cataloga el REXX....

* $$ JOB DISP=D,CLASS=0,JNM=REXXTEL4
* $$ LST DISP=D,CLASS=M,DEST=(,JEF),RBS=0,JSEP=0
// JOB REXXTEL4
* Cataloging the member
// EXEC LIBR,PARM='A S=PRD3.TCPIP;CATALOG OOPSMAI4.PROC REP=Y EOD=/='
/*

You will need to change to "server" and "from" variables.

*/

ARG to jobname class . /* Get the passed arguments */

/* ------------------------ Change this] --------------------------- */
/* server='63.245.8.201' Put the server name here */
/* from='"Automatic Sender"<'||jobname||'@MNEMOTECH.COM>' */
from=vseesa@||'ig390.com' ain info here
server='63.245.8.201'
user='XXXX'
pass='XXXX'
sysid='02'
/* ----------------------- Start of the code ----------------------- */
call buildtext /* Build the body of the text */
call open /* Connect to EMAIL client */
buffer='EMAIL' /* Setup the name of the client */
call send /* Send the request */
call receive /* Receive response */
buffer='SET USERID='||user
call send /* Send the request */
call receive /* Receive response */
buffer='SET PASSWORD='||pass
call send /* Send the request */
call receive /* Receive response */
buffer='SET HOST='||server /* Point to the SMTP server */
call send /* Send the request */
call receive /* Receive response */
buffer='SET FROM='||from /* Get the "From" name */
call send /* Send the request */
call receive /* Receive response */
buffer='SET TO='||to /* Get the "To" name */
call send /* Send the request */
call receive /* Receive response */
buffer='SET SUBJECT='||jobname||': Reporte Agencias Invalidas'
call send /* Send the request */
call receive /* Receive response */
buffer='TEXT' /* Begin the body of the message */
call send /* Send the request */
call receive /* Receive response */
buffer=text1 /* ----- Limited to 80-byte sizes */
call send /* Send the request */
call receive /* Receive response */
buffer=text2 /* ----- So we will split it in 2 */
call send /* Send the request */
call receive /* Receive response */
buffer='/+' /* End of text */
call send /* Send the request */
call receive /* Receive response */
buffer='CD POWER.LST.'||class /* Go to where the report is */
call send /* Send the request */
call receive /* Receive response */
call query
call receive /* Receive response */
buffer='SEND '||jobname||' AS '||jobname||'.TXT'
call send /* Send the request */
call receive /* Receive response */
call close /* Receive response */
exit 0 /* Terminate the program */
/* ------------------------------------------------------------------*/

/* ----------------------- OPEN Routine ---------------------------- */
buildtext:
today=date()
today=today||' at '||time('N')
text1='Va Listado,'||jobname||',de Agencias no Reportadas '||today||'.'
text2='o con error en el Envio '
return
/* ------------------------------------------------------------------*/

/* ----------------------- OPEN Routine ---------------------------- */
open: /* Start of routine */
X = SOCKET('CLIENT','OPEN',,,,sysid)
if x ¬= 0 then do /* If the OPEN failed... */
say errmsg /* Display the error message */
exit 20 /* And exit this program */
end /* Otherwise... */
return /* Return to caller */
/* ------------------------------------------------------------------*/
/* ----------------------- CLOSE Routine --------------------------- */
close: /* Start of routine */
x = SOCKET(handle,'CLOSE') /* Close the SOCKET */
return /* Return to caller */
/* ------------------------------------------------------------------*/

/* ----------------------- SEND Routine ---------------------------- */
send: /* Start of routine */
say buffer /* Let's see what we are sending */
x=SOCKET(handle,'SEND',buffer)
if x \= 0 then do /* If it failed... */
say errmsg /* Tell us why */
say "when processing" buffer /* Tell us why */
call abort /* Abort the connection */
call close /* Close the connection */
exit 8 /* And terminate the program */
end /* If it worked... */
return /* Return to caller */
query: /* Start of routine */
/* set CC=YES to remove carriage control */
/* set CC=NO to have it remain in the output file */
x=SOCKET(handle,'SEND','SET CC=NO')
if x \= 0 then do /* If it failed... */
say errmsg /* Tell us why */
say "when processing Query"
end /* If it worked... */
return /* Return to caller */
/* ------------------------------------------------------------------*/

/* ----------------------- ABORT Routine --------------------------- */
abort: /* Start of routine */
x=SOCKET(handle,'ABORT') /* Abort the connection */
if x \= 0 then say errmsg /* If it failed, tell the user */
return /* Return to caller */
/* ------------------------------------------------------------------*/

/* ---------------------- RECEIVE Routine -------------------------- */
receive: /* Start of routine */
do forever /* Do until we find a match */
X = SOCKET(HANDLE,'RECEIVE') /* Receive a response */
if x > 4 then do /* If it failed... */
say errmsg /* Tell us what went wrong */
call abort /* Abort the connection */
call close /* Close the connection */
exit x /* And terminate the program */
end /* Otherwise... */
say buffer /* What came back ? */
if end = "Y" & buffer = "Connection complete" then return
loc=POS('Ready:',buffer) /* Look for another keyword */
if loc > 0 then return /* And if we found it, it's okay */
end /* Repeat */
/* ------------------------------------------------------------------*/
/=
/*
* /. EXIT
/&
* $$ EOJ


Un poco largo y aburrido,,, de Antemano Gracias
Mario Izaguirre
Tecnico de Sistemas
IBM z/Series

Responder