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
 

 

Rexx PGM holding a dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Oct 08, 2010 12:44 am    Post subject: Rexx PGM holding a dataset
Reply with quote

Hi,

I have a job whic creates a file in a REXX program in the first step.

I try to use that file in another program in the second step, and I get the message that the file is in use by some other user.

I used FINIS and FREE in my program but still am facing the issue.

Any insights please?

Thanks,
Sathya.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Oct 08, 2010 1:04 am    Post subject:
Reply with quote

Hello,

If the first step has rexx code that creates the file and the step ends, the file should be free (whether it freed in the code or not - i believe).

How is the first step being executed? How is the second step being executed? Is it in fact a separate jcl step?

It may help if you post the jcl for the first step and the problem step.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Oct 08, 2010 2:36 am    Post subject: Reply to: Rexx PGM holding a dataset
Reply with quote

Who is the file in use by?
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Oct 08, 2010 2:22 pm    Post subject: code snap
Reply with quote

Code:

"ALLOC DA('XX.XX.XXXX.XXXXX') F(OUT)",       
"NEW RECFM(F,B) DIR(0) SPACE(5,5) BLKS(10) LRECL(80)",     
"BLKSIZE(27920) REUSE"

---
---
---

"EXECIO 6 DISKW OUT (STEM OUTPUT. FINIS"   
"FREE F(OUT)"                             


This is my pgm. The file created in this step is FTPd in the next step.

And below is the error message.

Code:

450 Data set tied up by another user


Any suggestions would be really helpful. I even tried using a LIMCOPY to copy this file to another file and then FTP it. But LIMCOPY doesnt work too.

Thanks,
Sathya
Back to top
View user's profile Send private message
kacks7

New User


Joined: 22 Sep 2010
Posts: 33
Location: chennai(india)

PostPosted: Fri Oct 08, 2010 3:07 pm    Post subject:
Reply with quote

i think your program is stopped executing before freeing the file.

add one more line with 'say' something next to freeing the file and check are you getting the 'say' or not.

or

check with trace.
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Oct 08, 2010 4:22 pm    Post subject:
Reply with quote

Bala,

I am using this program in a job. I wont be able to use the Trace option. But I already tried to trace it in online excecution and the control reaches to the statements below the free statement.

Thanks,
Sathya
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: Fri Oct 08, 2010 4:24 pm    Post subject:
Reply with quote

sathyaraj wrote:
I am using this program in a job. I wont be able to use the Trace option.
Rubbish, of course you will be able to use TRACE
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Oct 08, 2010 4:52 pm    Post subject:
Reply with quote

Sorry,

I was not aware that it could be done when running it in a job as well. Anyways I confirmed that control flows past the FREE statement. And that is not the purpose of this post. Please lets not argue with this.

If I have made something wrong with the way I coded or is there any restriction to use the file created in one step in the following steps please guide me on that.

I tried the same with a member of PDS and it works fine. Does that ring a bell somewhere?

Thanks,
Sathya.
Back to top
View user's profile Send private message
kacks7

New User


Joined: 22 Sep 2010
Posts: 33
Location: chennai(india)

PostPosted: Fri Oct 08, 2010 5:48 pm    Post subject:
Reply with quote

Quote:
Anyways I confirmed that control flows past the FREE statement.


may i know how you you confirmed that it executing beyond tat FREE???
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Oct 08, 2010 6:19 pm    Post subject: Reply to: Rexx PGM holding a dataset
Reply with quote

did You check properly the return code from the free ???
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Fri Oct 08, 2010 7:03 pm    Post subject:
Reply with quote

Hi,

I checked the return code after FREE and it is 0. Am compeltely clueless on what is holding the dataset back.

Thanks,
Sathya
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Oct 08, 2010 7:31 pm    Post subject: Reply to: Rexx PGM holding a dataset
Reply with quote

I think we all need to take a few steps back on this topic. As Dick already stated originally, there's no possible way that a REXX exec that created a dataset in one step can have any exclusive control over it in an entire other step. I asked you for some proof that the exec has a hold on that dataset, and not some other process or user. I think you need to forget about this being a REXX issue and look somewhere else (i.e. the second step that you've referred to).

A few questions I have:

- Why are you creating a dataset in your exec with a TSO ALLOCATE command instead of using the JCL to do it? Where is there a CATALOG command? Is there more to the process that what you're showing us?
- Why do you need a seperate step to run an FTP? Why not put all of that process into a single exec?
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Tue Oct 12, 2010 1:36 pm    Post subject:
Reply with quote

Hello All,
I am also getting a simialr problem.
Description :

In my rexx script
Step 1: I am deleting the dataset if it already exists
Code:
IF SYSDSN(DMLGEN.OUTPUT1.DMLSTMTS) = OK THEN         
  "DELETE DMLGEN.OUTPUT1.DMLSTMTS"     

Step 2 : Then I allocate the dataset and write
Code:
"ALLOC FILE (OUTDD) DATASET ('DMLGEN.OUTPUT1.DMLSTMTS') MOD REUSE"     
 "EXECIO * DISKW OUTDD ( STEM LN."   

Step 3 :
Then i close and free the dataset
Code:

"EXECIO 0 DISKW OUTDD (FINIS"       
"FREE F (OUTDD"   


However I get the below Error message, when some one else try to open the data set for viewing or browsing. The user who creates the data set is able to do all the operations on it.
Code:
 ISRD035 Data set 'T386796.DMLGEN.OUTPUT1.DMLSTMTS' in use by another user,   
  try later or enter HELP for a list of jobs and users allocated to             
  'T386796.DMLGEN.OUTPUT1.DMLSTMTS'.                                           
                                                                               


Extended error message
Code:
 Data set 'T386796.DMLGEN.OUTPUT1.DMLSTMTS'                     
 is in use by the following 1 user(s) and/or job(s):           
----------------------------------------------------------------
  T386796                                                       


Please advise.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue Oct 12, 2010 1:54 pm    Post subject:
Reply with quote

tomehta,

try using PROFILE NOPREFIX
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Tue Oct 12, 2010 7:51 pm    Post subject:
Reply with quote

Hi
I did a work around like below which somehow is working, (no sure how )

Code:
IF PS_STATUS = OK THEN                                         
   "ALLOC FILE (OUTDD) DATASET ('"PS"') MOD REUSE"             
ELSE                                                           
  DO                                                           
    "ALLOC DA ('"PS"') NEW F(OUTDD)",                           
    "SPACE(50,20) DSORG(PS) RECFM(F,B) LRECL(80) BLKSIZE(800)"
 "EXECIO * DISKW OUTDD ( STEM LN." 


Peter ,
With NOPREFIX , I am not able to delete dataset, as I want to keep the dataset name in following fashion
<USERID>.DMLGEN.OUTPUT.*

Regards
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Oct 13, 2010 1:53 am    Post subject: Reply to: Rexx PGM holding a dataset
Reply with quote

The basic problem for tomehta is the inconsistent use of quotes in the name.
Code:

/* step 1 */
IF SYSDSN(DMLGEN.OUTPUT1.DMLSTMTS) = OK THEN         
  "DELETE DMLGEN.OUTPUT1.DMLSTMTS"     
/*Step 2 */
"ALLOC FILE (OUTDD) DATASET ('DMLGEN.OUTPUT1.DMLSTMTS') MOD REUSE"

Because of PREFIX and the use of quotes, step 1 refers to a different dataset than step 2.
Back to top
View user's profile Send private message
sathyaraj

New User


Joined: 28 Sep 2007
Posts: 71
Location: India.

PostPosted: Wed Oct 20, 2010 4:45 pm    Post subject: Finally fixed it...
Reply with quote

All,

It is resolved now. But still I cant understand how it worked.. I ll try to explain..

My job had three steps..

step1- create a file using rexx
step2- FTP the file
step3 - delete the file (IEFBR14)

I was having the issue with the second step. Error msg was that the file is being held by some one.

Then as a trial and error, I removed the delete step and the setup worked like a charm icon_smile.gif

Now I have the set up like
step1 - delete the file (IEFBR14)
step2- create a file using rexx
step3- FTP the file

This works fine. Any idea how my IEFBR14 in the third step could have held the file that was tried for FTP in second step?

Cheers,
Sathya.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Oct 20, 2010 4:51 pm    Post subject: Reply to: Rexx PGM holding a dataset
Reply with quote

I haven't really understood much of this topic from the very beginning. Why would you go through the whole process of creating a dataset, FTP'ing it, and then deleting it? Why wouldn't you just use a temporary dataset? And, if you already have a REXX exec written and in use, why not invoke the FTP from it and save a whole step?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


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