IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

EZACFSM1 created file name - passing to email issue


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Tue Sep 30, 2014 9:33 pm
Reply with quote

I've been digging through here for a couple days without luck, and JCL isn't my strength, so have mercy, but here's the issue in a nutshell - I have a couple JCL that run after a nightly batch cycle, take 70 odd .csv files created during the cycle, squish them together, sort them and mail them as a report. Everything worked, but now they want date and time as part of the file names. I added an EZCAFSM1 step and create the file name as a variable:

Code:
//USERX JOB (TESTT),'CG993-SORT(ALL AGYS)',CLASS=H,MSGCLASS=X,     
//           MSGLEVEL=(1,1),TIME=(,15)                               
//*                                                                   
//EZACFSM1  EXEC PGM=EZACFSM1                                         
//SYSOUT    DD   SYSOUT=(*,INTRDR)                                   
//SYSIN     DD   DATA,DLM=##                                         
//USERY JOB (TESTT),'130245 ',MSGCLASS=X,                         
//           MSGLEVEL=(1,1),TIME=(,15)                               
//***********************************************************
//*                                                                   
//          SET SFILE=SORTEDFILE.D&LYYMMDD..T&LHHMMSS..CSV       
//*       


... and this works fine, giving me the sorted output file name just like I want it. However, it's when I try and use that as an attachment that I have issues. In this step the main body of the email is in .SMTPHDR

Code:
//STEP99M EXEC PGM=IEBGENER,COND=(0,LT)                     
//SYSIN    DD DUMMY                                         
//SYSPRINT DD SYSOUT=*                                       
//SYSUT2   DD SYSOUT=(B,SMTP)                               
//SYSUT1   DD DSN=DEV.DATA.PROGRAM.SMTPHDR,DISP=SHR 
//         DD DSN=&SFILE,DISP=SHR                           
//         DD DSN=DEV.DATA.PROGRAM.SMTPEND,DISP=SHR 
//*                                                         
//   IF RC > 0   THEN                                       
//STEP99F EXEC PGM=IEBGENER                                 
//SYSIN    DD DUMMY                                         
//SYSPRINT DD SYSOUT=*                                       
//SYSUT2   DD SYSOUT=(B,SMTP)                               
//SYSUT1   DD DSN=DEV.DATA.PROGRAM.SMTPERR,DISP=SHR 
//   ENDIF                                                   
##                                                           
//                                                             


(JCL ends here)

.SMTPHDR looks like this -

Code:
helo WTC                                                     
mail From: <email addresses removed>                         
rcpt to: -                           
data                                                         
From: -
Reply-To: -                         
Errors-To: -                         
To: -                               
Subject:   Report - Cases             
MIME-Version: 1.0                                             
Content-Type: multipart/mixed;                               
  boundary="<boundary>"                                       
--<boundary>                                                 
Content-Type: text/plain; charset=ISO-8859-1                 
                                                             
  The Report is attached.           
  Thanks                                       
                                               
--<boundary>                                   
--<boundary>                                   
CONTENT-TYPE: TEXT/PLAIN; CHARSET=ISO-8859-1   
CONTENT-DISPOSITION: ATTACHMENT;               
   FILENAME='&SFILE'             



(There is a blank line after 'FILENAME=') This is the only place the substitution isn't working. I've tried with or without quotes, it simply sends whatever is after FILENAME= as a literal. How do I get the substitution into the .SMTPHDR, or do I need to redo how the email is constructed?

Hopefully I explained this well enough. Thanks in advance!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Sep 30, 2014 10:55 pm
Reply with quote

What release of z/OS are you on? Symbol-substitution in data cards (rather than JCL) is quite a new thing.
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Tue Sep 30, 2014 11:21 pm
Reply with quote

Bill Woodger wrote:
What release of z/OS are you on? Symbol-substitution in data cards (rather than JCL) is quite a new thing.


1.13.
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Tue Sep 30, 2014 11:31 pm
Reply with quote

Oops, DBA just corrected... 1.12.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Sep 30, 2014 11:42 pm
Reply with quote

Available in v2.1 I think.
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 12:01 am
Reply with quote

Terry Heinze wrote:
Available in v2.1 I think.


Well... poo. Any recommendations then?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Oct 01, 2014 12:44 am
Reply with quote

We're on 1.13 where I'm at. icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 01, 2014 1:45 am
Reply with quote

Which SORT product do you have? DFSORT supports JCL symbols, up to 10 of them (JP0 to JP9). You could run your cards through SORT, get the substitution done, and feed that file into your e-mail producer.

If you have SyncSORT, and up-to-date, it may also have that. Not sure.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 1:42 pm
Reply with quote

What about scheduler software date and time variables which are valid in both JCL and control statements ?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Oct 01, 2014 5:16 pm
Reply with quote

Try adding these two steps to your Job before STEP99M.

The value of SFILE is of course your own.

Code:
//SYMBOLIC SET SFILE=MY.SFILE
//GENER0   EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN    DD DUMMY
//SYSUT1   DD *
ARG DATAIN
QUEUE 'FILENAME='||DATAIN
"EXECIO 1 DISKW OUTFILE (OPEN FINIS)"
EXIT
/*
//SYSUT2   DD DSN=&&TEMP0(WRITE),UNIT=SYSALLDA,
//            SPACE=(TRK,(1,1,2),RLSE),
//            DISP=(NEW,PASS),DCB=(LRECL=80,
//            BLKSIZE=1600,DSORG=PO,RECFM=FB)
//WRITE2   EXEC PGM=IRXJCL,PARM='WRITE &SFILE'
//SYSEXEC    DD DSN=&&TEMP0,DISP=SHR
//SYSTSPRT   DD SYSOUT=Z
//OUTFILE    DD DSN=DEV.DATA.PROGRAM.SMTPHDR2, 
//           DISP=(NEW,CATLG,CATLG),
//           UNIT=SYSDA,
//           DCB=(BLKSIZE=0,LRECL=80,RECFM=FB),
//           SPACE=(TRK,(1,1),RLSE)
//*


Remove FILENAME='&SFILE' from your header.

Change your SYSUT1 to:
Code:
//SYSUT1   DD DSN=DEV.DATA.PROGRAM.SMTPHDR,DISP=SHR 
//         DD DSN=DEV.DATA.PROGRAM.SMTPHDR2,DISP=SHR 
//         DD DSN=&SFILE,DISP=SHR                           
//         DD DSN=DEV.DATA.PROGRAM.SMTPEND,DISP=SHR 
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 5:30 pm
Reply with quote

Can you not have the attachment defined to a DDname with the DSN defined there rather than trying to use the symbolic in control cards ?
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 6:47 pm
Reply with quote

Dave, thank you, it's so close I can smell it. It did toss an error:

Code:
IEF032I STEP/GENER0  /STOP  2014274.0901                                       
        CPU:     0 HR  00 MIN  00.00 SEC    SRB:     0 HR  00 MIN  00.00 SEC   
        VIRT:    72K  SYS:   264K  EXT:        8K  SYS:    10240K               
IEF236I ALLOC. FOR DEVY984Y WRITE2                                             
IGD103I SMS ALLOCATED TO DDNAME SYSEXEC                                         
IEF237I JES2 ALLOCATED TO SYSTSPRT                                             
IGD101I SMS ALLOCATED TO DDNAME (OUTFILE )                                     
        DSN (DEV.DATA.PROGRAM.SMTPHDR2            )                     
        STORCLAS (INVTSEQ) MGMTCLAS (EXP006M) DATACLAS (INVTSEQ)               
        VOL SER NOS= APDI10                                                     
IRX0110I The REXX exec cannot be interpreted.                                   
IRX0112I The REXX exec cannot be loaded.                                       
IEF142I DEVY984Y WRITE2 - STEP WAS EXECUTED - COND CODE 0020                   
IGD106I SYS14274.T090149.RA000.DEVY984Y.TEMP0.H05    PASSED,    DDNAME=SYSEXEC 
IEF285I   DEVY984.DEVY984Y.J0082611.D0000109.?         SYSOUT                   
IGD104I DEV.DATA.PROGRAM.SMTPHDR2             RETAINED,  DDNAME=OUTFILE


But I noticed that the SMTPHDR2 was created, it's just empty. Is it possible that the REXX error is due to the step being contained within the EZACFSM1 stuff or did I screw something up I failed to see? I love the elegance in this though, let's hope it's a simple tweak...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 6:57 pm
Reply with quote

I think that the /* REXX */ is missing. Also, can't remember for sure but I know that there are some strange limitations when using IRXJCL so recommend IKJEFT01 instead which gives you full TSO functionality.

Try
Code:

     /*   REXX   */                             
ARG DATAIN
QUEUE 'FILENAME='||DATAIN
"EXECIO 1 DISKW OUTFILE (OPEN FINIS)"
EXIT


Or perhaps just the REXX step to get the required info
JCL
Code:

//STEP0020 EXEC PGM=IKJEFT01
//FILENAME DD DSN=&SFILE.,DISP=SHR
//OUTPUTDD DD DSN=whatever,DISP=(,CATLG,DELETE),
 .................... DCB / SPACE etc ...............
//SYSOUT   DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD *
 /* REXX - Get dataset name from DDname */
    X = LISTDSI("FILENAME  FILE")
    PUSH " FILENAME = '"Strip(SYSDSNAME)"'"
    "EXECIO DISKW 1 OUTPUTDD ( FINIS"
  EXIT
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 9:05 pm
Reply with quote

Thanks expat

I tried the REXX step you posted - it looks like this in the JCL:

Code:
//STEP99A  EXEC PGM=IKJEFT01                                         
//FILENAME DD DSN=&SFILE.,DISP=SHR                                   
//OUTPUTDD DD DSN=DEV.DATA.PROGRAM.SMTPHDR2,                 
//           DISP=(,DELETE,DELETE),                                 
//           UNIT=SYSDA,                                             
//           DCB=(BLKSIZE=0,LRECL=80,RECFM=FB),                     
//           SPACE=(TRK,(1,20),RLSE)                                 
//SYSOUT   DD SYSOUT=*                                               
//SYSTSPRT DD SYSOUT=*                                               
//SYSTSIN  DD *                                                     
 /* REXX */                                                         
    X = LISTDSI("FILENAME  FILE") S)"                               
    PUSH " FILENAME = '"STRIP(SYSDSNAME)"'"                         
    "EXECIO DISKW 1 OUTPUTDD ( FINIS"                               
  EXIT                                                               
//*


It's throwing a cond code 12:

Code:
IEF373I STEP/STEP99A /START 2014274.1128                                       
IEF032I STEP/STEP99A /STOP  2014274.1128                                       
        CPU:     0 HR  00 MIN  00.01 SEC    SRB:     0 HR  00 MIN  00.00 SEC   
        VIRT:    40K  SYS:   316K  EXT:      348K  SYS:    10432K               
IEF202I DEVY984W STEP99M - STEP WAS NOT RUN BECAUSE OF CONDITION CODES         
IEF272I DEVY984W STEP99M - STEP WAS NOT EXECUTED.     



In SYSTSPRT I see this:

Code:
READY                                           
 */                                             
IKJ56621I INVALID COMMAND NAME SYNTAX           
READY                                           
LISTDSI("FILENAME  FILE") S)"                   
IKJ56621I INVALID COMMAND NAME SYNTAX           
READY                                           
 " FILENAME = '"STRIP(SYSDSNAME)"'"             
IKJ56621I INVALID COMMAND NAME SYNTAX           
READY                                           
CIO DISKW 1 OUTPUTDD ( FINIS"                   
IKJ56500I COMMAND CIO NOT FOUND                 
READY                                           
  EXIT                                         
IKJ56500I COMMAND EXIT NOT FOUND               
READY                                           
END


I think I'm missing something...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 9:10 pm
Reply with quote

Strange

You have posted the line as
Code:
   X = LISTDSI("FILENAME  FILE") S)"                               

But I have posted
Code:
   X = LISTDSI("FILENAME  FILE")


I know it works, because I have used it numerous times icon_confused.gif

Looks like it has ignored the /* REXX bit of the code.
Can you try putting the code into either a PDS or PS

Code:
//SYSEXEC  DD DSN=PS dataset name,DISP=SHR

If you use a PS then resubmit the job, if you use a PDS you will need to change the EXEC card to add
Code:
,PARM='member name'
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 9:16 pm
Reply with quote

Just looked again .... WIERD ...... It seems that you are missing the first bytes of the SYSTSIN data.

Do you have your ISPF session set up as COBOL input or something ???
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 9:20 pm
Reply with quote

Paste fail. After all this... paste fail. Please... tell no one.

I'll try the PS/PDS thing... paste fail. ugh.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Oct 01, 2014 9:21 pm
Reply with quote

icon_lol.gif

You're not the first and you won't be the last
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 9:25 pm
Reply with quote

expat wrote:
Just looked again .... WIERD ...... It seems that you are missing the first bytes of the SYSTSIN data.

Do you have your ISPF session set up as COBOL input or something ???


Forgive me for being really green at this, but I'm not sure what you mean here. We're a Natural shop, so I'd be surprised... is there something I should check?
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 9:47 pm
Reply with quote

OK, nevermind... I moved the REXX over past ten bytes and it worked!

Now I just need to get past STMPHDR2 being a duplicate name...
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 10:13 pm
Reply with quote

Almost works. No errors, but SMTPHDR2 isn't getting populated.

Code:
//STEP99A  EXEC PGM=IKJEFT01                                 
//FILENAME DD DSN=&SFILE.,DISP=SHR                           
//OUTPUTDD DD DSN=DEVDIT.ACP.DATA.PIP49112.SMTPHDR2,         
//           DISP=SHR                                                               
//SYSOUT   DD SYSOUT=*                                       
//SYSTSPRT DD SYSOUT=*                                       
//SYSTSIN  DD *                                             
/*        REXX */                                           
    X = LISTDSI("FILENAME  FILE")                           
    PUSH " FILENAME = '"STRIP(SYSDSNAME)"'"                 
    "EXECIO DISKW 1 OUTPUTDD ( FINIS"                       
  EXIT                                                       
//*   
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Oct 01, 2014 11:03 pm
Reply with quote

I ran this before I submitted it. It works perfect for me.

The /* REXX */ is NOT required. When IRXJCL is using SYSEXEC, REXX is implied.

Did you run this EXACTLY as I had it?

Please show your JCL and your error.
Back to top
View user's profile Send private message
MSecorsky

New User


Joined: 26 Sep 2014
Posts: 11
Location: USA

PostPosted: Wed Oct 01, 2014 11:29 pm
Reply with quote

Welcome back Dave. OK, here's the JCL:

Code:
//SYMBOLIC SET SFILE=&SFILE                                 
//GENER0   EXEC PGM=IEBGENER                                 
//SYSPRINT DD DUMMY                                         
//SYSIN    DD DUMMY                                         
//SYSUT1   DD *                                             
ARG DATAIN                                                   
QUEUE 'FILENAME='||DATAIN                                   
"EXECIO 1 DISKW OUTFILE (OPEN FINIS)"                       
EXIT                                                         
/*                                                           
//SYSUT2   DD DSN=&&TEMP0(WRITE),UNIT=SYSALLDA,             
//            SPACE=(TRK,(1,1,2),RLSE),                     
//            DISP=(NEW,PASS),DCB=(LRECL=80,                 
//            BLKSIZE=1600,DSORG=PO,RECFM=FB)               
//WRITE2   EXEC PGM=IRXJCL,PARM='WRITE &SFILE'               
//SYSEXEC    DD DSN=&&TEMP0,DISP=SHR                         
//SYSTSPRT   DD SYSOUT=Z                                     
//OUTFILE    DD DSN=DEVDIT.ACP.DATA.PIP49112.SMTPHDR2,       
//           DISP=(NEW,CATLG,CATLG),                         
//           UNIT=SYSDA,                                     
//           DCB=(BLKSIZE=0,LRECL=80,RECFM=FB),             
//           SPACE=(TRK,(1,1),RLSE)                         
//*                                                       


Placed right before the 99M step. Here's the error it's tossing...

Code:
IEF373I STEP/GENER0  /START 2014274.1354                                     
IEF032I STEP/GENER0  /STOP  2014274.1354                                     
        CPU:     0 HR  00 MIN  00.00 SEC    SRB:     0 HR  00 MIN  00.00 SEC 
        VIRT:    72K  SYS:   264K  EXT:        8K  SYS:    10248K             
IEF236I ALLOC. FOR DEVY984W WRITE2                                           
IGD103I SMS ALLOCATED TO DDNAME SYSEXEC                                       
IEF237I JES2 ALLOCATED TO SYSTSPRT                                           
IGD101I SMS ALLOCATED TO DDNAME (OUTFILE )                                   
        DSN (DEVDIT.ACP.DATA.PIP49112.SMTPHDR2           )                   
        STORCLAS (INVTSEQ) MGMTCLAS (EXP006M) DATACLAS (INVTSEQ)             
        VOL SER NOS= APDI01                                                   
IRX0110I The REXX exec cannot be interpreted.                                 
IRX0112I The REXX exec cannot be loaded.                                     
IEF142I DEVY984W WRITE2 - STEP WAS EXECUTED - COND CODE 0020                 
IGD106I SYS14274.T135454.RA000.DEVY984W.TEMP0.H05    PASSED,    DDNAME=SYSEXEC
IEF285I   DEVY984.DEVY984W.J0098397.D0000109.?         SYSOUT                 
IGD104I DEVDIT.ACP.DATA.PIP49112.SMTPHDR2            RETAINED,  DDNAME=OUTFILE
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Oct 01, 2014 11:49 pm
Reply with quote

Try changing the SYSUT2 to a permanent PDS like:

Code:
//SYSUT2   DD DSN=TEMP.PDS(WRITE),UNIT=SYSALLDA,
//            SPACE=(TRK,(1,1,2),RLSE),
//            DISP=(NEW,CATLG),DCB=(LRECL=80,
//            BLKSIZE=1600,DSORG=PO,RECFM=FB)


and the SYSEXEC to:

Code:
//SYSEXEC    DD DSN=TEMP.PDS,DISP=SHR


Another thought....
What was the return code from the IEBGENER step?

Is the UNIT=SYSALLDA valid at your shop?

Another option is to skip the fancy instream the REXX stuff with IEBGENER all together.

Put the exec into a known REXX library, and run the WRITE2 step only.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top