View previous topic :: View next topic
|
Author |
Message |
scorp_rahul22 Currently Banned New User
Joined: 06 Aug 2007 Posts: 42 Location: chennai
|
|
|
|
/*REXX*/
DSN1="K3EYB.DSN.OUTPUT5"
"ALLOC FI(INDSN5) DA('"DSN1"') SHR"
"ALLOC F(INDSN6) DA('K3EYB.FILE.OUTPUT.REXX') SHR";
CURRENT=1
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
"EXECIO "HEAP" DISKR INDSN5 "CURRENT" (STEM INREC."
RCODE=RC
DO I=1 TO INREC.0
INPREC=STRIP(INREC.I,L,' ');
INPREC=STRIP(INPREC,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC
END
CURRENT=CURRENT+HEAP;
"EXECIO * DISKW INDSN6 (STEM OUT."
END
"EXECIO 0 DISKR INDSN5 (FINIS"
"EXECIO 0 DISKW INDSN6 (FINIS"
"FREE F(INDSN5)";
"FREE F(INDSN6)";
EXIT;
i am writting this code and this is repeating lines
suppose i have input file of 137252 records
it is showing output file of 160000 (multiple of 40000)
can u please solve this problem |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
it is conceptually WRONG to use "EXECIO * DISKW"
wise programmers ALWAYS specify the number of records to be written
there are lots of reasons to avoid the style You used..
sibce You did not drop the stem used for output the out. thing after the first full heap will chave 40000 occurrences,
at the last iteration You fill 30000 something,
but the other will still be in the variable pool, and as a consequence they will be written out |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Yesterday at 9.57 am, there was a line with OUT. = "" in the program.
At 12.40 pm, that line was gone.
This line was more or less equivalent to the DROP that enrico stated.
EXECIO * DISKW with STEM will write lines until it reaches an empty value.
If you have complete control of your variables, it will work fine.
If you're not sure, store the number of records (in OUT.0 for example).
It is a better practice, specially if you have more process on the stem variable (in that case, DO I = 1 TO OUT.0 works great) |
|
Back to top |
|
|
scorp_rahul22 Currently Banned New User
Joined: 06 Aug 2007 Posts: 42 Location: chennai
|
|
|
|
CURRENT=1
HEAP=100
RCODE=0;
DO UNTIL RCODE <> 0
DROP INREC.0
"EXECIO "HEAP" DISKR INDSN5 "CURRENT" (STEM INREC."
SAY INREC.0
RCODE=RC
DO I=1 TO INREC.0
INPREC=STRIP(INREC.I,L,' ');
INPREC=STRIP(INPREC,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC
END
CURRENT=CURRENT+HEAP;
"EXECIO * DISKW INDSN6 (STEM OUT."
I am writting this code but still it is going till 500 when i have only 450 records. can u plz help |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
You already got all the help You needed,
Just pay more attention when reading the replies |
|
Back to top |
|
|
scorp_rahul22 Currently Banned New User
Joined: 06 Aug 2007 Posts: 42 Location: chennai
|
|
|
|
I am not getting desired result , thats why i am asking again. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
You are not getting the desired resulst because ...
YOU DO NOT PAY ATTENTION
requoting one of my previous posts
Quote: |
t is conceptually WRONG to use "EXECIO * DISKW"
wise programmers ALWAYS specify the number of records to be written
there are lots of reasons to avoid the style You used..
since You did not drop the stem used for output
the out. thing after the first full heap will have 40000 occurrences,
at the last iteration You fill 30000 something,
but the other will still be in the variable pool, and as a consequence they will be written out |
|
|
Back to top |
|
|
scorp_rahul22 Currently Banned New User
Joined: 06 Aug 2007 Posts: 42 Location: chennai
|
|
|
|
CURRENT=1
HEAP=5
RCODE=0;
DO UNTIL RCODE <> 0
INREC.=""
"EXECIO "HEAP" DISKR INDSN5 "CURRENT" (STEM INREC."
SAY INREC.0
RCODE=RC
DO I=1 TO INREC.0
INPREC=STRIP(INREC.I,L,' ');
INPREC=STRIP(INPREC,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC
END
CURRENT=CURRENT+HEAP
"EXECIO * DISKW INDSN6 (STEM OUT."
END
"EXECIO 0 DISKR INDSN5 (FINIS"
i am trying with this , but same result |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
I cannot do anything else but
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
repeat and repeat and repeat and repeat and repeat and repeat and ...
DROP THE F*****G OUT. STEM AFTER THE EXECIO ... DISKW
OR USE "EXECIO " inrec.0 " DISKW" |
|
Back to top |
|
|
|