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

Multiple Datasets not getting created in RunTime


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Oct 29, 2009 7:44 pm
Reply with quote

Hi,

This is my rexx program.
Code:

/**** REXX **************************************/ 
 "ALLOC DA('myid.PLAN.COLL') F(INPUT) SHR REUSE"
 "EXECIO * DISKR INPUT (STEM LINES. FINIS"         
                                                   
 DO I=1 TO LINES.0                                 
    PARSE VAR LINES.I PLANNAME COLLECTION         
                                                   
    CALL COLLQUERY PLANNAME, COLLECTION           

 END                                               

COLLQUERY: PROCEDURE           
                               
PLANNAME   = STRIP(ARG(1))     
COLLECTION = STRIP(ARG(2))     
.
.
.
.
ADDRESS TSO
FN = 'myid.'                                                       
FN = FN || PLANNAME || '.' || COLLECTION                             
SAY 'DATASET NAME : ' FN                                             
"ALLOC FI(OUTREC) DA('"FN"') MOD DELETE REUSE",                     
"CYL SPACE(10,10) LRECL(200) RECFM(F,B,A) DSORG(PS)"                 
"EXECIO *  DISKW OUTREC (STEM RECORD. FINIS"                         
RETURN

Contents of the FILE : myid.PLAN.COLL
Code:
AAIPPLAN                  AAI1
AAIPPLAN                  CLIC
AAIPPLAN                  INEO



My Goal is , the program should read the input file.

Send the two fields to the sub-routine.

It does some processing.

After each processing a file with following naming convention should be created
Code:
myid.AAIPPLAN.AAI1
myid.AAIPPLAN.CLIC
myid.AAIPPLAN.INEO


But, what is happening is only the last dataset is being created myid.AAIPPLAN.INEO.
So, for testing purposes i edited the input file and removed myid.AAIPPLAN.INEO. So, if i run again the rexx program,
myid.AAIPPLAN.CLIC dataset should be created. But, what happened is myid.AAIPPLAN.INEO got replaced by myid.AAIPPLAN.CLIC.




Thank You,
Sushanth
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 29, 2009 7:47 pm
Reply with quote

Run using TRACE ?I to see what happens when, and that should help find the error
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Oct 29, 2009 8:03 pm
Reply with quote

Sushanth,

Try with this.

Code:
"ALLOC FI(OUTREC) DA('"FN"') MOD REUSE",                     
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Oct 29, 2009 8:18 pm
Reply with quote

Thank You Very Much SriHari, it works.

Can i know what seems to be the problem ?

Sushanth
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 29, 2009 8:21 pm
Reply with quote

Yes, by specifying DELETE the dataset gets deleted when the dataset is closed and released
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Oct 29, 2009 8:26 pm
Reply with quote

expat,

Before making these changes, why last dataset did not get deleted.

Sushanth
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Oct 29, 2009 8:29 pm
Reply with quote

I don't know about anyone else, but I don't see a FREE command anywhere in your code...
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 29, 2009 8:29 pm
Reply with quote

Mmmmmmmmmmmmmmmmmmm, interesting point.

I can only think that the last dataset was not freed up by the REUSE because being the last dataset the REUSE would not be executed again.

Something to look into when I get a lazy afternoon icon_lol.gif
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Thu Oct 29, 2009 8:54 pm
Reply with quote

SuperK,

Code:
"FREE F(OUTREC)"


I added the above statement.

Thank You,
Sushanth
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 29, 2009 8:58 pm
Reply with quote

doesn't REUSE inplies FREE when a new allocation is made to the same DD
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Oct 29, 2009 9:20 pm
Reply with quote

A few side remarks:

Quote:
"ALLOC FI(OUTREC) DA('"FN"') MOD REUSE",
"CYL SPACE(10,10) LRECL(200) RECFM(F,B,A) DSORG(PS)"

10 Cylinders? Do you really need that? (If not, add the RELEASE option or use TRACKS)
In RECFM, "A" indicates the record contains ASCII printer control characters. Do you really need that? (If not, just remove)

Quote:
END

COLLQUERY: PROCEDURE

What, no EXIT after the end? Then COLLQUERY is executed one more time...

Quote:
FN = 'myid.'
FN = FN || PLANNAME || '.' || COLLECTION

Enjoy the power and beauty of REXX:
FN = 'myid.'PLANNAME'.'COLLECTION
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Oct 29, 2009 9:23 pm
Reply with quote

Just a personal pet peeve, but everyone who uses the TSO ALLOCATE command needs to get into the habit of FREE'ing those allocations when they're no longer needed.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Oct 29, 2009 11:26 pm
Reply with quote

And rather than 'myid', you should code it for general use:
Code:
SysVar('SysPref')

Will use the user's desired dataset prefix.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Oct 30, 2009 12:59 am
Reply with quote

Quote:

In RECFM, "A" indicates the record contains ASCII printer control characters. Do you really need that? (If not, just remove)

Correction: the "A" in RECFM does not refer to ASCII characters. It actually indicates that the records contain ISO/ANSI printer control characters ( ISO stands for International Organization for Standards, and ANSI stands for American National Standards Institute ). The "A" USED to stand for ASA ( American Standards Association ), the predecessor to ANSI.
If the file is a print file, and actually contains carriage control characters in the first byte, then the "A" in RECFM is required if you want the printer to honor the carriage control characters. Removing the "A" will result in actually printing the contents of byte-1, probably truncating byte 121 or 133, ( standard record lengths for reports with carriage control ) and single spacing the entire report.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Oct 30, 2009 12:09 pm
Reply with quote

Hello Marso,

1. I have added RELEASE open in ALLOCation.

2. My mistake, there were few more operations after the loop in main prog.

3. Made changes to concatenating variables.


Hi Pedro,

For testing purposes, i am using myid, when its going for real, i will be changing it as per systems naming convention.


Ronald Burr,


i have removed 'A' in RECFM. Since, i don't require printer control characters.


Thank You Marso, Thank You Pedro & Thank You Ronald Burr.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top