Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Send Email from cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Mon Apr 03, 2006 10:27 pm    Post subject: Send Email from cobol program
Reply with quote

Hi,

Is it possible to send an email from a cobol program. I mean suppose I have completed a request in a program and have to notify the user via email. So is there anyway how can I achieve this.

Thanks
Back to top
View user's profile Send private message

new2cobol

New User


Joined: 04 Jan 2006
Posts: 77
Location: Bangalore

PostPosted: Mon Apr 03, 2006 10:32 pm    Post subject: Re: Send an email from cobol program.
Reply with quote

As per what you have said, I guess you need to add a step in the JCL for email...

Search the forum... this has been discussed much before...

or try this link
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/F1A1B950/6.0?DT=20050708142126
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Mon Apr 03, 2006 10:35 pm    Post subject: Re: Send an email from cobol program.
Reply with quote

new2cobol,

Well what i have is a stored procedure and no jcl is involved in it. Is there any other way

thanks
Back to top
View user's profile Send private message
WDNEALS

New User


Joined: 04 Apr 2006
Posts: 1

PostPosted: Tue Apr 04, 2006 12:44 am    Post subject: SMTP
Reply with quote

006500 FD EMAIL 00650034
006600 RECORDING MODE IS F 00660034
006700 BLOCK CONTAINS 0 RECORDS. 00670034
006800 01 EMAIL-MSG PIC X(80). 00680099


007500 01 WS-SWITCHES. 00750034
007600 05 WS-EMAIL-SW PIC X VALUE ' '. 00760099
007700 88 WS-NO-EMAILS-SEEN VALUE ' '. 00770099
007800 88 WS-EMAIL-OPEN VALUE 'Y'. 00780099
007900 88 WS-EMAIL-CLOSED VALUE 'N'. 00790034

019900 05 WS-EMAIL-CNT PIC S9(6) COMP. 01990032


012800 01 WS-EMAIL-HEADER. 01280034
012900 05 WS-EMAIL-HDR1 PIC X(80) VALUE 01290099
013000 'HELO HCFJES'. 01300034
013100 05 WS-EMAIL-HDR2 PIC X(80) VALUE 01310099
013200 'MAIL FROM:<MY@EMAIL.COM>'. 01320034
013300 05 WS-EMAIL-HDR3. 01330080
013500 10 FILLER PIC X(09) VALUE 'RCPT TO:<'. 01350099
013600 10 WS-EMAIL-HDR3-TO PIC X(71). 01360099
013900 05 WS-EMAIL-HDR5 PIC X(80) VALUE 'DATA'. 01390099
014000 05 WS-EMAIL-HDR6. 01400073
014200 10 FILLER PIC X(06) VALUE 'DATE: '. 01420099
014300 10 WS-EMAIL-HDR6-TIMESTAMP PIC X(26). 01430073
014400 10 FILLER PIC X(58) VALUE SPACES. 01440099
014500 05 WS-EMAIL-HDR7 PIC X(80) VALUE 01450099
014600 'FROM: EDYALOW <MY@EMAIL.COM>'. 01460034
014700 05 WS-EMAIL-HDR8. 01470081
014900 10 FILLER PIC X(05) VALUE 'TO: '. 01490099
015000 10 WS-EMAIL-HDR8-TO PIC X(75). 01500099
015500 05 WS-EMAIL-HDR11 PIC X(80) VALUE 'SUBJECT: TEST'. 01550099


071500 3200-EMAIL. 07150018
071600 IF WS-EMAIL-CLOSED 07160024
071700 OPEN OUTPUT EMAIL 07170029
071800 SET WS-EMAIL-OPEN TO TRUE 07180024
071900 END-IF. 07190024
072000 PERFORM 3210-FORMAT-MSG-HEADER THRU 3210-EXIT. 07200024
072100 PERFORM 3220-SEND-MSG THRU 3220-EXIT. 07210024
072200 IF NOT WS-ERROR 07220033
072300 ADD 1 TO WS-EMAIL-CNT 07230033
072400 END-IF. 07240033
072500 CLOSE EMAIL. 07250099
072600 SET WS-EMAIL-CLOSED TO TRUE. 07260099
072700 CALL WS-IKJEFT1B USING WS-MAILFILE. 07270099
072800 3200-EXIT. 07280018
072900 EXIT. 07290018
073000 07300018
073100 3210-FORMAT-MSG-HEADER. 07310024
073200 MOVE WS-DEST-EMAIL-TO TO WS-MYSTR. 07320099
073300 PERFORM 3230-TRIM THRU 3230-EXIT. 07330099
073400 MOVE WS-MYSTR TO WS-EMAIL-HDR3-TO. 07340099
073500 MOVE WS-DEST-EMAIL-TO TO WS-MYSTR. 07350099
073600 PERFORM 3230-TRIM THRU 3230-EXIT. 07360099
073700 MOVE WS-MYSTR TO WS-EMAIL-HDR8-TO. 07370099
073800 MOVE ODES-TIMESTAMP TO WS-EMAIL-HDR6-TIMESTAMP. 07380099
073900 3210-EXIT. 07390024
074000 EXIT. 07400018
074100 07410024
074200 3220-SEND-MSG. 07420024
074300 WRITE EMAIL-MSG FROM WS-EMAIL-HDR1. 07430070
074400 WRITE EMAIL-MSG FROM WS-EMAIL-HDR2. 07440077
074500 WRITE EMAIL-MSG FROM WS-EMAIL-HDR3. 07450070
074600* WRITE EMAIL-MSG FROM WS-EMAIL-HDR4. 07460073
074700 WRITE EMAIL-MSG FROM WS-EMAIL-HDR5. 07470070
074800 WRITE EMAIL-MSG FROM WS-EMAIL-HDR6. 07480070
074900 WRITE EMAIL-MSG FROM WS-EMAIL-HDR7. 07490078
075000 WRITE EMAIL-MSG FROM WS-EMAIL-HDR8. 07500070
075100* WRITE EMAIL-MSG FROM WS-EMAIL-HDR9. 07510073
075200* WRITE EMAIL-MSG FROM WS-EMAIL-HDR10. 07520073
075300 WRITE EMAIL-MSG FROM WS-EMAIL-HDR11. 07530070
075400 WRITE EMAIL-MSG FROM ODES-MSG-TEXT. 07540070
075500 3220-EXIT. 07550024
075600 EXIT. 07560024
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Apr 04, 2006 5:32 am    Post subject: Re: Send an email from cobol program.
Reply with quote

Have you considered writing a routine that would format and send the SMTP strings via TCP/IP sockets.
Back to top
View user's profile Send private message
iamyinhe

New User


Joined: 27 Apr 2006
Posts: 7

PostPosted: Fri May 05, 2006 9:57 pm    Post subject: Re: Send an email from cobol program.
Reply with quote

Sorry,COBOL is not JAVA
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Fri May 05, 2006 11:44 pm    Post subject: Re: Send an email from cobol program.
Reply with quote

Muffirulz, this is something that I was working on recently out of necessity. You can use the content if you wish.

Code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. EMAIL.
       INSTALLATION.
       AUTHOR. SUPERK.
       DATE-WRITTEN. 4/8/2006.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.

         FILE-CONTROL.
           SELECT REXX-FILE ASSIGN TO UT-S-SYSPROC
             ORGANIZATION IS SEQUENTIAL
             ACCESS IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD  REXX-FILE
           LABEL RECORD STANDARD
           BLOCK 0 RECORDS
           RECORDING MODE F
           RECORD CONTAINS 255 CHARACTERS.
       01 REXX-RECORD     PIC X(255).

       WORKING-STORAGE SECTION.
       01 MAILBOX-ADDRESS              PIC X(64).
       01 REPLYTO-ADDRESS              PIC X(64).
       01 DEBUG-ACTION                 PIC X(5).
       01 FILLER.
          05  WS-DUMMY                 PIC S9(8) COMP.
          05  WS-RETURN-CODE           PIC S9(8) COMP.
          05  WS-REASON-CODE           PIC S9(8) COMP.
          05  WS-INFO-CODE             PIC S9(8) COMP.
          05  WS-CPPL-ADDRESS          PIC S9(8) COMP.
          05  WS-FLAGS                 PIC X(4) VALUE X'00010001'.
          05  WS-BUFFER                PIC X(256).
          05  WS-LENGTH                PIC S9(8) COMP VALUE 256.
       01 JOB-NAME                     PIC X(8).
       01 PROC-STEP                    PIC X(8).
       01 STEP-NAME                    PIC X(8).
       01 JOB-NUMBER                   PIC X(8).
       01 PROGRAM-NAME                 PIC X(8).
       01 USER-ID                      PIC X(8).
       01 GROUP-NAME                   PIC X(8).
       01 USER-NAME                    PIC X(20).
       01 BATCH-OR-CICS                PIC X(5).
       01 FOUR-BYTES.
          05  FULL-WORD                PIC S9(8) COMP.
       01 JOB-NAMEX                    PIC X(8).

       01 SMTP-SERVER-1                PIC X(64) VALUE
           'SMTP.SERVER.1'.
       01 SMTP-SERVER-2                PIC X(64) VALUE
           'SMTP.SERVER.2'.
       01 SMTP-SERVER-3                PIC X(64) VALUE
           'SMTP.SERVER.3'.

       01 MESSAGE-TABLE.
          05 MESSAGE-TEXT OCCURS 30 TIMES.
              10 FILLER                PIC X(80).
       01 IDX                          PIC 9(2) COMP.

       LINKAGE SECTION.
       01 CB1.
          05 PTR1 POINTER OCCURS 256.
       01 CB2.
          05 PTR2 POINTER OCCURS 256.
       01  PARM.
           05 PARM-LENGTH        PIC S9(04) COMP SYNC.
           05 THE-PARM           PIC X(100).

       PROCEDURE DIVISION USING PARM.
           UNSTRING THE-PARM
           DELIMITED BY ',' INTO MAILBOX-ADDRESS
                            REPLYTO-ADDRESS
                            DEBUG-ACTION.
           INSPECT MAILBOX-ADDRESS REPLACING ALL LOW-VALUES BY SPACES.
           INSPECT REPLYTO-ADDRESS REPLACING ALL LOW-VALUES BY SPACES.
           INSPECT DEBUG-ACTION REPLACING ALL LOW-VALUES BY SPACES.

           MOVE SPACES TO MESSAGE-TABLE.
           PERFORM GET-MESSAGE-TEXT
             VARYING IDX FROM 1 BY 1
               UNTIL IDX = 30.

           CALL 'IKJTSOEV' USING WS-DUMMY WS-RETURN-CODE WS-REASON-CODE
             WS-INFO-CODE WS-CPPL-ADDRESS.
           IF WS-RETURN-CODE > 0
             DISPLAY 'IKJTSOEV FAILED, RETURN-CODE=' WS-RETURN-CODE
               ' REASON-CODE=' WS-REASON-CODE 'INFO-CODE=' WS-INFO-CODE
             UPON CONSOLE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE SPACES TO WS-BUFFER.
           MOVE 'ALLOC DD(SYSOUT) SYSOUT(*) REUSE'
             TO WS-BUFFER.
           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.

           DISPLAY WS-BUFFER UPON CONSOLE.
           IF WS-RETURN-CODE > 0
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
               ' REASON-CODE=' WS-REASON-CODE
             UPON CONSOLE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           SET ADDRESS OF CB1 TO NULL.
           SET ADDRESS OF CB1 TO PTR1(136).
           SET ADDRESS OF CB2 TO PTR1(4).
           MOVE CB2(1:8) TO JOB-NAME.
           MOVE CB2(9:8) TO PROC-STEP.
           MOVE CB2(17:8) TO STEP-NAME.
           SET ADDRESS OF CB2 TO PTR1(46).
           MOVE CB2(361:8) TO PROGRAM-NAME.
           SET ADDRESS OF CB2 TO PTR2(80).
           MOVE CB2(13:8) TO JOB-NUMBER.
           SET ADDRESS OF CB2 TO PTR1(53).
           IF CB2(21:4) = LOW-VALUES THEN
             MOVE 'BATCH' TO BATCH-OR-CICS
           ELSE
             MOVE 'CICS ' TO BATCH-OR-CICS
           END-IF.
           SET ADDRESS OF CB1 TO NULL.
           SET ADDRESS OF CB1 TO PTR1(138).
           SET ADDRESS OF CB2 TO PTR1(28).
           MOVE CB2(193:8) TO USER-ID.
           SET ADDRESS OF CB2 TO PTR2(51).
           MOVE CB2(31:8) TO GROUP-NAME.
           SET ADDRESS OF CB1 TO PTR2(26).
           MOVE ZERO TO FULL-WORD.
           MOVE CB1(1:1) TO FOUR-BYTES(4:1).
           MOVE CB1(2:FULL-WORD) TO USER-NAME.
           MOVE JOB-NAME TO JOB-NAMEX.
           INSPECT JOB-NAMEX REPLACING ALL ' ' BY '@'.

           MOVE SPACES TO WS-BUFFER.
           IF DEBUG-ACTION IS NOT EQUAL TO 'DEBUG'
             STRING 'ALLOC DD(SYSPROC)'
                    ' DA('
                    QUOTE
                    'PPDD.'
                    JOB-NAMEX
                    '.REXX'
                    QUOTE
                    ') NEW REUSE DELETE RECFM(F B) LRECL(255)'
                    ' BLKSIZE(0) SPACE(1,1) CYLINDERS'
                    ' UNIT(SYSDA)'
             DELIMITED BY SIZE INTO WS-BUFFER
           ELSE
             STRING 'ALLOC DD(SYSPROC)'
                    ' DA('
                    QUOTE
                    'HLQ.'
                    JOB-NAMEX
                    '.REXX'
                    QUOTE
                    ') NEW REUSE CATALOG RECFM(F B) LRECL(255)'
                    ' BLKSIZE(0) SPACE(1,1) CYLINDERS'
                    ' UNIT(SYSDA)'
             DELIMITED BY SIZE INTO WS-BUFFER.
           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.

           IF DEBUG-ACTION IS EQUAL TO 'DEBUG'
             DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > 0
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
               ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           OPEN OUTPUT REXX-FILE.

           MOVE SPACES TO REXX-RECORD.
           MOVE '/* REXX */' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'TRACE O' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'CRLF = X2C("0D25")' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'JOBNAME = STRIP("'
                  JOB-NAME
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'JOBID = STRIP("'
                  JOB-NUMBER
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_ADDRESS1 = STRIP("'
                  SMTP-SERVER-1
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_ADDRESS2 = STRIP("'
                  SMTP-SERVER-2
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_ADDRESS3 = STRIP("'
                  SMTP-SERVER-3
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_MAILBOX = STRIP("'
                  MAILBOX-ADDRESS
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_REPLYTO = STRIP("'
                  REPLYTO-ADDRESS
                  '")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'SMTP_SUBJECT = "MESSAGE FROM "'
                  '||JOBNAME||"."||JOBID||"@TIAA-CREF.ORG"'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.

           MOVE 'STR = SOCKET("INITIALIZE",DATE(B))' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SOCKET","AF_INET","STREAM","TCP")'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC SOCKID' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'STR = SOCKET("SETSOCKOPT",SOCKID,"SOL_SOCKET",'
                  '"SO_ASCII","ON")'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'SERVER_INFO="AF_INET 25 "SMTP_ADDRESS1' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("CONNECT",SOCKID,SERVER_INFO)'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'MSG = "HELO "||SMTP_ADDRESS1||CRLF' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'SAY MSG' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC DATA_LENGTH SMTP_RESPONSE'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'SAY "RECV:"STR' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE SPACES TO REXX-RECORD.
           STRING 'MSG = "MAIL FROM:<AUTOOPERATOR@TIAA-CREF.ORG>"'
                  '||CRLF'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC DATA_LENGTH SMTP_RESPONSE'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'MSG = "RCPT TO:<"||SMTP_MAILBOX||">"||CRLF'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC DATA_LENGTH SMTP_RESPONSE'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'MSG = "DATA"||CRLF' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC DATA_LENGTH SMTP_RESPONSE'
             TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'MSG = "TO:"||SMTP_MAILBOX||CRLF,' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE '||"REPLY-TO:"||SMTP_REPLYTO||CRLF,' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE '||"SUBJECT:"SMTP_SUBJECT||CRLF,' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE '||"X-MAILER: REXX EXEC ON MVS"||CRLF' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,CRLF)' TO REXX-RECORD.
           WRITE REXX-RECORD.

           PERFORM WRITE-MESSAGE-TEXT
             VARYING IDX FROM 1 BY 1
               UNTIL IDX = 30.

           MOVE 'MSG = CRLF||"."||CRLF' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("RECV",SOCKID,10000)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'PARSE VAR STR SOCKRC DATA_LENGTH SMTP_RESPONSE'
             TO REXX-RECORD.
           WRITE REXX-RECORD.

           MOVE 'MSG = "QUIT"||CRLF' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("CLOSE",SOCKID)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("TERMINATE",SUBTASKID)' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'SAY "EMAIL SENT TO "||SMTP_MAILBOX' TO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'EXIT 0' TO REXX-RECORD.
           WRITE REXX-RECORD.
           CLOSE REXX-FILE.

           MOVE SPACES TO WS-BUFFER.
           STRING 'EXEC '
                  QUOTE
                  'PPDD.'
                  JOB-NAMEX
                  '.REXX'
                  QUOTE
           DELIMITED BY SIZE INTO WS-BUFFER.
           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.

           IF DEBUG-ACTION IS EQUAL TO 'DEBUG'
             DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > 0
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE SPACES TO WS-BUFFER.
           MOVE 'FREE DD(SYSPROC)' TO WS-BUFFER.
           CALL 'IKJEFTSR' USING WS-FLAGS WS-BUFFER WS-LENGTH
             WS-RETURN-CODE WS-REASON-CODE WS-DUMMY.

           IF DEBUG-ACTION IS EQUAL TO 'DEBUG'
             DISPLAY WS-BUFFER.
           IF WS-RETURN-CODE > 0
             DISPLAY 'IKJEFTSR FAILED, RETURN-CODE=' WS-RETURN-CODE
             ' REASON-CODE=' WS-REASON-CODE
             MOVE WS-RETURN-CODE TO RETURN-CODE
             STOP RUN.

           MOVE 0 TO RETURN-CODE.
           STOP RUN.

       GET-MESSAGE-TEXT.
           ACCEPT MESSAGE-TEXT(IDX) FROM SYSIN.

       WRITE-MESSAGE-TEXT.
           MOVE SPACES TO REXX-RECORD.
           STRING 'MSG = STRIP("'
                  MESSAGE-TEXT(IDX)
                  '")||CRLF'
           DELIMITED BY SIZE INTO REXX-RECORD.
           WRITE REXX-RECORD.
           MOVE 'STR = SOCKET("SEND",SOCKID,MSG)' TO REXX-RECORD.
           WRITE REXX-RECORD.
Back to top
View user's profile Send private message
hariavinash

New User


Joined: 04 Jan 2006
Posts: 64

PostPosted: Fri May 05, 2006 11:54 pm    Post subject:
Reply with quote

why bother with the program itself. after your request completion use a jcl iebgener to send the email.

just a suggestion, not necessarily suits ur requirement.

cheers
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us