Page 1 of 1

Display/email the FILENAME created in a prior JCL step

PostPosted: Tue Sep 09, 2014 7:01 pm
by hariharan_bk
Hi All,

I need suggestion to display the filename (in spool) which is being generated in an earlier step of a JCL.

Also i need to email the same filename to a specified email id.. can u pls provide me any JCL snippet for these requirements.

Thanks in Advance...

Re: Display/email the FILENAME created in a prior JCL step

PostPosted: Tue Sep 09, 2014 10:15 pm
by NicC
Depends what you mean by
display the filename (in spool)
. If you are looking at the JCL of the job in the spool the dataset name (not filename) will be there in the JCL both in the JCL expansion and the allocation messages.

Regarding e-mail - have you searched the forum to see how others code their e-mail JCL?

Re: Display/email the FILENAME created in a prior JCL step

PostPosted: Wed Sep 10, 2014 5:35 am
by steve-myers
By the way, in z/OS a “file” is the data on magnetic tape between the beginning of the tape and a “file mark”, or the data between two “file marks.” Period. End of story. There are no “files” on disk storage. z/OS uses “data sets.” A “file” in toy and baby systems is an unstructured stream of bytes, compared to a “data set,” which has a structure.

You are asking two independent questions here.

The simplest way to retrieve a data set name is by using JCL symbols, like this -

// SET NAME='xxx'
//STEP1 EXEC PGM=...
//ADD DD DSN=&NAME,...
//STEP2 EXEC PGM=...,PARM='&NAME'

The program in STEP2 can retrieve the data set name through the parameter text, and substitute it as it desires.

In theory, an Assembler program can retrieve information like this in storage, but the details change from time to time, which would invalidate the program. The Assembler code could be replicated by a very clever programmer in Cobol, or even a Rexx exec, but a system change would wreck the code, and it would be difficult to repair.

There is no "standard" way to send an e-mail in z/OS. If it is possible at your site, you must consult with support at your site. In most sites it seems the program in STEP2 prepares a text file that is sent to another program, perhaps in STEP3, that actually sends the e-mail. The details for your site must be obtained from your site's support.

Re: Display/email the FILENAME created in a prior JCL step

PostPosted: Mon Sep 22, 2014 7:14 pm
by andyyoung
Are you using a scheduler package such as TWS/OPC to run this job? If so, you can use a TWS defined at runtime variable name as the last qualifier of the DSN when being created. Use the same variable name to read the DSN later in the JCL and for the email, pass the same DSN to to whatever method you use to email in batch.
If of course you don't use a scheduler package, sorry!