Display/email the FILENAME created in a prior JCL step

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Display/email the FILENAME created in a prior JCL step

Postby hariharan_bk » Tue Sep 09, 2014 7:01 pm

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...
Many Thanks,
Posts: 73
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

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

Postby NicC » Tue Sep 09, 2014 10:15 pm

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?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby steve-myers » Wed Sep 10, 2014 5:35 am

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'

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.
Global moderator
Posts: 2086
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 235 times

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

Postby andyyoung » Mon Sep 22, 2014 7:14 pm

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!
Posts: 3
Joined: Mon Sep 22, 2014 6:11 pm
Has thanked: 0 time
Been thanked: 0 time

Return to JCL


  • Related topics
    Last post