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

Way to remove the quotes from the records


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Mon Dec 31, 2007 4:10 pm
Reply with quote

000000010 'EWP.SQ.MB.DERVTN.TABLE.ALS' RDWDDWIS
000000011 'EWP.SQ.MB.DERVTN.TABLE.HIER' RDWDDWIS
000000013 'EWP.SQ.MB.DERVTN.TABLE.ST' RDWDDWIS
000000014 'NSP.EDW.LOADLIB' EWWM31CU
000000015 'NSP.EDW.LOADLIB' EWWM31IU
000000016 'NSP.EDW.LOADLIB' EWWM31PU
000000017 'NSP.EDW.LOADLIB' EWWM310U
000000018 'NSP.EDW.LOADLIB' EWWM312U
000000019 'NSP.EDW.LOADLIB' EWWM316U


Its not removing quotes
in the case
INPREC=STRIP(INREC.I,'L',' ');
INPREC=STRIP(INPREC,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC



and when i m writting
DO I=1 TO INREC.0
PARSE VAR INREC.I GARB1 "'" DATA "'" GARB2
OUT.I = DATA


it is generating empty file
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Dec 31, 2007 6:57 pm
Reply with quote

Code:
/*REXX*/
DSN1="NBK3EYB.DSN.OUTPUT2"
"ALLOC FI(INDSN) DA('"DSN1"') SHR"
"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT.REXX') SHR";
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
   "EXECIO "HEAP" DISKR INDSN (STEM INREC."
   RCODE=RC
   OUT. = ""
   DO I=1 TO INREC.0
      Parse Var INREC.I . "'" Data "'" .
      OUT.I = Data                               
   END
   "EXECIO * DISKW INDSN2 (STEM OUT."
END
"EXECIO 0 DISKW INDSN2 (FINIS"
"FREE F(INDSN)";
"FREE F(INDSN2)";
EXIT;

I did some tests with that rexx but I had to change from MOD to SHR in the ALLOC command because I used PDS and not DS.
I removed the FINIS in the EXECIO DISKW and placed a FINIS after the loop.
The OUT. = '' cleans the output array, it's useful when reading the last pack of records.
For cosmetics, I used placeholders (.) instead of garbage fields in the PARSE line.
It worked for me.
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Jan 01, 2008 12:27 pm
Reply with quote

I AM TRYING BUT THAT IS NOT WORKING IN THIS CASE ALSO


IT IS SHOWING


FILE INDSN5 NOT FREED, DATA SET IS OPEN
***


/*REXX*/
DSN1="NBK3EYB.TEMP.REXX"
"ALLOC FI(INDSN5) DA('"DSN1"') SHR"
"ALLOC F(INDSN6) DA('NBK3EYB.FILE.OUTPUT.REXX') SHR";
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
"EXECIO "HEAP" DISKR INDSN5 (STEM INREC."
RCODE=RC
OUT. = ""
DO I=1 TO INREC.0
PARSE VAR INREC.I . "'" DATA "'" .
OUT.I = DATA
END
"EXECIO * DISKW INDSN6 (STEM OUT."
END
"EXECIO 0 DISKW INDSN6 (FINIS"
"FREE F(INDSN5)";
"FREE F(INDSN6)";
EXIT;
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jan 01, 2008 2:45 pm
Reply with quote

Forgot to close the input file before the FREE:
Code:
"EXECIO 0 DISKR INDSN5 (FINIS"
"EXECIO 0 DISKW INDSN6 (FINIS"
"FREE F(INDSN5)";
"FREE F(INDSN6)";
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Jan 01, 2008 3:10 pm
Reply with quote

/*REXX*/
DSN1="K3EYB.DSN.OUTPUT2"
"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 (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;



this is not working . its not removing the quotes
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Tue Jan 01, 2008 4:34 pm
Reply with quote

/*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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jan 01, 2008 8:50 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jan 02, 2008 3:39 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Thu Jan 03, 2008 5:44 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 03, 2008 6:13 pm
Reply with quote

Quote:
can u plz help


You already got all the help You needed,
Just pay more attention when reading the replies
Back to top
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Thu Jan 03, 2008 6:28 pm
Reply with quote

I am not getting desired result , thats why i am asking again.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 03, 2008 6:41 pm
Reply with quote

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
View user's profile Send private message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Thu Jan 03, 2008 6:43 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 03, 2008 6:53 pm
Reply with quote

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
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top