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
 

 

EZACFSM1 created file name - passing to email issue
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: EZACFSM1 created file name - passing to email issue
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Sep 30, 2014 10:55 pm    Post subject: Reply to: EZACFSM1 created file name - passing to email issu
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    Post subject: Re: Reply to: EZACFSM1 created file name - passing to email
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    Post subject:
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: 1238
Location: Richfield, MN, USA

PostPosted: Tue Sep 30, 2014 11:42 pm    Post subject:
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    Post subject:
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: 1238
Location: Richfield, MN, USA

PostPosted: Wed Oct 01, 2014 12:44 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Oct 01, 2014 1:45 am    Post subject: Reply to: EZACFSM1 created file name - passing to email issu
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 1:42 pm    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Wed Oct 01, 2014 5:16 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 5:30 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 6:57 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 9:10 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 9:16 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Oct 01, 2014 9:21 pm    Post subject:
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    Post subject:
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    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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