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

How to Get the PS File name


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

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Mon Jan 11, 2010 9:34 pm
Reply with quote

Hi..

Can you please suggest that how can we get the PS file name which has generated in the previous steps, in the same job? I want to write that in a work file so that can use it in my application program.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Jan 11, 2010 9:52 pm
Reply with quote

Please explain exactly what you want to do. Along with the requirement to do it in this fashion.

Dataset names are specified in the JCL and remain constant through the job execution lifecycle. Unless you are dynamically generating a dataset name from within a program, which IMHO is pretty bad practice, then the sucessor programs within the same job will need to dynamically allocate the file using the name generated originally.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Jan 11, 2010 10:29 pm
Reply with quote

You can refer back to dataset(s) in previous step(s) by DDNAME.

O.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 11, 2010 10:37 pm
Reply with quote

10 to 1 Anthony is generating a PS file with a date as part of one of the DSN nodes.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Tue Jan 12, 2010 3:29 am
Reply with quote

If your program needs to find the actual dsname allocated to a ddname, search the web for programs that search the TIOT and JFCB control blocks, and of course, have someone at your site do a review of them with you to insure they suit your needs, are correct, and that you are legally allowed to use them for your particular pursuits. As ofer71 mentioned, the step looking for the dsname will need a referback dd to point to the ddname in the step that does the original allocation.
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 10:26 am
Reply with quote

Requirement goek like this, i have to make use of the NAME of the PS file generated say in third step. Now, in the fifth i have my application program which is getting called and it will take the PS file NAME also as an Input and based on that it will create few out put files (By suffixing some name at the last qualifier).

So, now, its important to paas the name of the PS file (Third Step) to my application program. Now, here i have to use Appliaction code to achieve this as there are few other task what my code is performing aprt from this.

Now, after generating an PS flat file in step-3, can we store it's NAME in an Work file so that i can read it in my program ?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Jan 12, 2010 11:24 am
Reply with quote

You can use LISTALC from within REXX , parse the output and get dataset name.

O.
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 12:04 pm
Reply with quote

Ihave never worked on REXX. yes, i have tried iN "TSO LISTALC" in ISPF and ot gives you all the datsets currently allocated.
But, in my case when i will have a new datset allocated in third step, can i write an JCL step to execute "TSO LISTALC" command. even if i do that, i will be getting the list of all the datasets allocated currently, but i require only the one which has generated in the third step...

So, to do this, i will have to store the output of the "TSO LISTALC" in a work file do an SORT out of it, to find the dataset what i am looking for ? am i correct ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 12, 2010 12:32 pm
Reply with quote

how is the DSN being 'generated' in the third step?
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Jan 12, 2010 12:40 pm
Reply with quote

As asked previously, how is the dataset name being generated by the program.

Unless you answer the questions we ask with the information we ask for, rather than what you deem we should be allowed to know, there isn't a lot we can do to help you.

Why not just do
Code:

//STEP03   EXEC PGM=Whatever
//DDNAME   DD DSN=Blah blah blah,DISP=(,CATLG,DELETE),
//           ...... etc etc

//STEP05   EXEC PGM=Whatever2
//DDNAME   DD DSN=Blah blah blah,DISP=SHR
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 12, 2010 12:43 pm
Reply with quote

or if the DSN is being magically generated in the third step,
use the same brew of mushrooms to generate the DSN in the 5th step.
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 12:44 pm
Reply with quote

Step 1 is the Extract step, Step 2 is the filter step, then three is the SORT step where we gets an PS flat file with all the attributes (like DCB, DSN, DISP) coded in the JCl itself.

And i require the name of this PS flat file to pas on to my application code.
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 12:49 pm
Reply with quote

I do not want to make use of the DSN name generated in the Third step to create an new DSN for the next step. i only need to store (or pass) that NAME so that i can apply few logical operations on that in my code.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Jan 12, 2010 12:53 pm
Reply with quote

Anyone here have a map of this thread .................... I'm totally lost icon_cry.gif

If, and only if, my interpretations are correct, you can specify any DSN you want for the SORTOUT DD name and then use it later in your job/application without having to do anything clever (aka stupid) anywhere at all.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 12, 2010 12:56 pm
Reply with quote

To summarize all solutions provided :

1. create dataset
2. use IRXJCL with the created dataset allocated
execute LISTALC
get the datasetname
write it to a workfile
3. use the contents of the work file as input

Now was that too difficult?
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Tue Jan 12, 2010 1:13 pm
Reply with quote

A much better solution is what ofer71 said near the beginning. Use a ddname with referback and don't worry about the data set name at all. If your data set is a &&TEMP dataset, you might not be able to allocate it dynamically anyway. Just use a ddname and read from that.

(btw, LISTALC is a TSO command, you need IKJEFTxx, not IRXJCL. From IRXJCL you could use BPXWDYN but that is way beyond this discussion)
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 12, 2010 1:21 pm
Reply with quote

MBabu wrote:

(btw, LISTALC is a TSO command, you need IKJEFTxx, not IRXJCL. From IRXJCL you could use BPXWDYN but that is way beyond this discussion)


You are right of course.

I understood that the TS "needs" the dataset name to trigger some processing. So refering back doesnt solve that problem.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 12, 2010 1:25 pm
Reply with quote

PeterHolland,

experience has shown that just purely providing 'what the TS wants',
is often
  • very poor programming standards
  • illogical
  • illegal - as in audit
  • a question based on lack of experience
  • not really conducive to furthering professionalism
.
The fact that step 3 is a sort step and will have the DSN HARDCODED in the DD statement,
the question arises: Why does the DSN need to be contained in a file?
when we ever receive the answer to that question, a good technical answer will probably be provided.

since your step 1
Quote:
1. create dataset
is a sort step, how do you suppose your step 2
Quote:
2. use IRXJCL with the created dataset allocated execute LISTALC get the datasetname write it to a workfile
would be accomplished?
As your step 3
Quote:
3. use the contents of the work file as input
implies usage of dynamic file allocation and the technical level of the TS implies little knowledge to implement such a process,
which by the way is something systems programmers do, not application programmers - again audit, ease of maintaining of code, etc...

Anthony is not being 'water boarded'. He is only being asked, 'Why does the DSN need to be contained in a file?'.
We have received no answer.
What you have suggested is unnecessarily difficult based on the scarce amount of 'real' information received.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 12, 2010 1:42 pm
Reply with quote

Hello Dick,

are you accusing me of the following ? :

Quote:


experience has shown that just purely providing 'what the TS wants',
is often
very poor programming standards
illogical
illegal - as in audit
a question based on lack of experience
not really conducive to furthering professionalism
.


I never mentioned SORT in my first step, it would be the 3rd step where
the dataset is created.
The TS needs the dataset name of that dataset to trigger processing
in his 5th step, so getting that dataset name could be accomplished by
rexx or clist (suggested in previous comments in this topic).
Dynamic allocation has nothing to do with that.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Jan 12, 2010 2:07 pm
Reply with quote

Peter,

I can not see where the OP has said that the dataset triggers anything, merely that he wants to use it in a later step of the same job.

The step creating the dataset is a sort step and as DBZ and I have already stated that the dataset name should be hardcoded.

Even if the OP uses the code below without a dataset name
Code:
//SORTOUT  DD SPACE=(unit,(p,s),RLSE), etc etc

he can still use a referback in a later step without even knowing the system generated dataset name. Maybe if we knew why the dataset name was of such prime importance we could possibly help out here.

Once again, we ask for pertinent information from the poster and all we get back is the mushroom syndrome.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 12, 2010 2:18 pm
Reply with quote

Hi expat

Quote:

Step 1 is the Extract step, Step 2 is the filter step, then three is the SORT step where we gets an PS flat file with
all the attributes (like DCB, DSN, DISP) coded in the JCl itself.

And i require the name of this PS flat file to pas on to my application code.
I do not want to make use of the DSN name generated in the Third step to create an new DSN for the next step.
i only need to store (or pass) that NAME so that i can apply few logical operations on that in my code.


It is not really important what program is used in step 3 for this discussion.
The second part of the quote means, that is what i see in it, that the TS
wants to use the dataset name for whatever processing in his program.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Jan 12, 2010 2:29 pm
Reply with quote

Peter,

Unless the OP can be bothered to actually tell us anything of any value we will never know what the requirement is or be able to offer any help whatsover.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 12, 2010 4:52 pm
Reply with quote

expat,

that leaves only a few candidates for help, i guess. icon_eek.gif
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 6:38 pm
Reply with quote

As suggested i have used IRXJCL to submit an REXX which will take the input file and will copy the PS file name into OUTSRCH step. Here i will be getting the value of &SFILE from the Previos step-3 which is the actual PS file name say AAA.BBB.

IN the beow PROC i have to capture the file name which is coming in &SFILE ..


Here is the JCL PROC
-----------------------------------------------------
//STEP1 PROC
//IRXJCL1 EXEC PGM=IRXJCL
//SYSEXEC DD DSN=AAA.PROCLIB(REXXPS),DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DSN=&SFILE,DISP=SHR
//&SFILE
//INSRCH DD DSN=&SFILE,
// DISP=SHR
//OUTSRCH DD DSN=AAA.BBB.OUT,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
// SPACE=(10,(10,5),RLSE)


Here is the REXX (Well, this is going to be my First REXX Code, so there can be mistakes)..

---------------------------------------------
/* REXX */
"EXECIO * DISKR INSRCH(STEM IN.FINIS";
PARSE UPPER PULL DSN
SAY "DSN=" DSN
PS = SUBSTR(DSN,19,8)
SAY PS
SAY "HELLO"
QUEUE PS
"EXECIO * DISKW OUTSRCH (FINIS";

I am getting the error as "CC 3637" . Can you please help me resolving this ?
Back to top
View user's profile Send private message
nemaji

New User


Joined: 29 May 2007
Posts: 22
Location: Pune

PostPosted: Tue Jan 12, 2010 6:49 pm
Reply with quote

Oh, i have missed a lot of post replies..

Actually, I have to code an SPLITTER in Natural language which will take an Big PS Flat file as an Input (This is the STEP-3 File we are talking here) and will Split it into the segments of 65535 (As this is further going to get downloaded as an CSV).

Now, I have my Natural Code ready which will READ the Input file and depending upon the number of records, it will generate the Segments and based in the Segment count (Say 4) it will generate number of IDCAMS step (From Natural). Here, i have the Problem.

When i am writing the IDCAMS Steps using Natural, i need to pass the Infile to it. (However i am generating the outFile programmatically in Natural).

So, Thats the reason i have started this POST so that i can pass the Input Big PS file to Natural.

Also, as this is going to be an generic SPLITTER so the JCL what i have coded is a PROC (Where i will call my Natural Module). So, whatever Job, which creates the Big PS Files and requires an SPLIT will directly Include This PROC in their JCL and will only Provide their InFile name as an input to this PROC. (As i have given the example in my previous post as AAA.BBB).

Now i think i have made my exact requirement very clear :-)
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top