View previous topic :: View next topic
Author
Message
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
What release of z/OS are you on? Symbol-substitution in data cards (rather than JCL) is quite a new thing.
Back to top
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
Oops, DBA just corrected... 1.12.
Back to top
Terry Heinze JCL Moderator Joined: 14 Jul 2008Posts: 1248 Location: Richfield, MN, USA
Available in v2.1 I think.
Back to top
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
Terry Heinze wrote:
Available in v2.1 I think.
Well... poo. Any recommendations then?
Back to top
Terry Heinze JCL Moderator Joined: 14 Jul 2008Posts: 1248 Location: Richfield, MN, USA
We're on 1.13 where I'm at.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
What about scheduler software date and time variables which are valid in both JCL and control statements ?
Back to top
daveporcelan Active Member Joined: 01 Dec 2006Posts: 792 Location: Pennsylvania
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
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
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
Paste fail. After all this... paste fail. Please... tell no one.
I'll try the PS/PDS thing... paste fail. ugh.
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
You're not the first and you won't be the last
Back to top
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
daveporcelan Active Member Joined: 01 Dec 2006Posts: 792 Location: Pennsylvania
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
MSecorsky New User Joined: 26 Sep 2014Posts: 11 Location: USA
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
daveporcelan Active Member Joined: 01 Dec 2006Posts: 792 Location: Pennsylvania
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
Please enable JavaScript!