View previous topic :: View next topic
|
Author |
Message |
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Run using TRACE ?I to see what happens when, and that should help find the error |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Sushanth,
Try with this.
Code: |
"ALLOC FI(OUTREC) DA('"FN"') MOD REUSE", |
|
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Thank You Very Much SriHari, it works.
Can i know what seems to be the problem ?
Sushanth |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Yes, by specifying DELETE the dataset gets deleted when the dataset is closed and released |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
expat,
Before making these changes, why last dataset did not get deleted.
Sushanth |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I don't know about anyone else, but I don't see a FREE command anywhere in your code... |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
SuperK,
I added the above statement.
Thank You,
Sushanth |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
doesn't REUSE inplies FREE when a new allocation is made to the same DD |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
And rather than 'myid', you should code it for general use:
Will use the user's desired dataset prefix. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
|