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
 

 

Way to remove the quotes from the records
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
scorp_rahul22
Currently Banned

New User


Joined: 06 Aug 2007
Posts: 42
Location: chennai

PostPosted: Fri Dec 28, 2007 4:47 pm    Post subject: Way to remove the quotes from the records
Reply with quote

Is there anf way to way to remove unwanted charcters from file.

EXAMPLE

INPUT

'DW3P.LKP.KBMA'
'DW4P.LKP.KBMAA'
'DW5P.LKP.KBMAAA'
'DW6P.LKP.KBMAAAA'
'DW7P.LKP.KBMAAAAA'

OUTPUT

DW3P.LKP.KBMA
DW4P.LKP.KBMAA
DW5P.LKP.KBMAAA
DW6P.LKP.KBMAAAA
DW7P.LKP.KBMAAAAA

ACTUALLY STARTING POSITION IS NOT FIXED FOR THESE ENTERIES :- What i mean to say it not necessary that DW will start from 1 column only and any number of useless symbols can be there before actual name.
Back to top
View user's profile Send private message

Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Fri Dec 28, 2007 5:02 pm    Post subject:
Reply with quote

read the file into the stem inrec.

and process each record in the following manner

Code:
do i=1 to inrec.0
inprec=strip(inrec.i,'L',' ');
j=length(inprec)-2;
inprec=substr(inprec,2,j);
out.i=inprec
end


write the output file from stem out.

I assumed that each record starts with a quote and ends with a quote
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 Dec 28, 2007 5:22 pm    Post subject:
Reply with quote

Or you could look at the TRANSLATE function in REXX
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Dec 28, 2007 9:46 pm    Post subject:
Reply with quote

1)You can Edit the file in ISPF editor and type command
Code:
c all "'" ""
.
2)You can use TRANSLATE or OVERLAY function of REXX.
But if it's a big file then you'll face problem while allocating it in the program.
3) Write a COBOL program and use INSPECT and REPLACING function.
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 Dec 28, 2007 10:17 pm    Post subject:
Reply with quote

Quote:
But if it's a big file then you'll face problem while allocating it in the program.

In what way will problems be faced ? All you need to do is to process the file in blocks. I have processed over 23 million records in one REXX exec with no problems.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Dec 28, 2007 10:37 pm    Post subject: Reply to: Way to remove the quotes from the records
Reply with quote

is there any reason to have two thread with the same question ??
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Dec 28, 2007 11:24 pm    Post subject:
Reply with quote

Expat,

Quote:
In what way will problems be faced ? All you need to do is to process the file in blocks. I have processed over 23 million records in one REXX exec with no problems.


I tried to allocate a big file (around 3000 Tracks) in REXX and got the error that system cannot bring this big file into memory for edit purpose.
I didn't know the technique to split the file in blocks. Could you please throw some more light on this.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Dec 28, 2007 11:31 pm    Post subject: Reply to: Way to remove the quotes from the records
Reply with quote

"EXECIO * DISKR" will read from the current position to the end of file

"EXECIO" number "DISKR" will read from the current position for the requested number of records

as usual stem.0 will be set to the number of record read
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Dec 28, 2007 11:35 pm    Post subject:
Reply with quote

Thanks enrico-sorichetti
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: Mon Dec 31, 2007 12:13 pm    Post subject:
Reply with quote

/* REXX */
DROP INREC. ;
/* "ALLOC F(INDSN) DA('NBK3EYB.FILE.INPUT(QOTES)') SHR" */
"ALLOC F(INDSN) DA('NBK3EYB.TEMP.REXX') SHR"
SAY RC ;
"EXECIO * DISKR INDSN (STEM INREC. FINIS" ;
"FREE F(INDSN)";
SAY RC ;
EXIT ;
"FREE F(INDSN)" ;
D = 1 ;
O = 1 ;
I = 1 ;
DROP OUTPUT. ;
SAY INREC.0
DO INREC.0
INPREC = STRIP(INREC.I,'L',"'");
J = LENGTH(INPREC) - 2 ;
INPREC = SUBSTR(INPREC,2,J) ;
OUT.I = INPREC
I = I + 1
END
CALL WRITE_LOAD
SAY "END OF THE PROGRAM";
EXIT ;
WRITE_LOAD
"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT1') SHR";
"EXECIO * DISKW INDSN2 (STEM OUTPUT. FINIS" ;
RETURN;



i am writting this but its not generating any output
its generating
empty file
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 31, 2007 12:38 pm    Post subject:
Reply with quote

Your EXIT statements in the code are not allowing it to go to the main loop. Try the following Snippet

/*REXX*/
"ALLOC F(INDSN) DA('NBK3EYB.TEMP.REXX') SHR"
"EXECIO * DISKR INDSN (STEM INREC. FINIS" ;
"FREE F(INDSN)";

do i=1 to inrec.0
inprec=strip(inrec.i,'L',' ');
inprec=strip(inrec.i,'T',' ');
j=length(inprec)-2;
inprec=substr(inprec,2,j);
out.i=inprec
end

"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT1') SHR";
"EXECIO * DISKW INDSN2 (STEM OUT. FINIS" ;
EXIT;
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: Mon Dec 31, 2007 12:46 pm    Post subject: Reply to: Way to remove the quotes from the records
Reply with quote

DATA SET NBK3EYB.TEMP.REXX NOT ALLOCATED, FILE IN USE
EXECIO error. Unable to obtain storage.
FILE INDSN NOT FREED, DATA SET IS OPEN
6 +++ INPREC=STRIP(INREC.I,'L',' ')
***

Error running REXXTEST, line 6: Machine storage exhausted
***




IT IS SHOWING THIS OUTPUT AND HAVE TO WORK ON 50 CRORES RECORD. SO CAN U TELL WHAT MODIFICATION WE HAVE TO DO IN THIS
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 31, 2007 1:14 pm    Post subject:
Reply with quote

As somebody already pointed out.....REXX stem variables can't handle so many records. Please check the following topic for help regarding this topic.

http://www.ibmmainframes.com/viewtopic.php?p=100518&highlight=#100518
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: Mon Dec 31, 2007 2:04 pm    Post subject: Reply to: Way to remove the quotes from the records
Reply with quote

/*REXX*/
DSN1=NBK3EYB.DSN.OUTPUT2 /*FILE CONTAINS 64716 RECORDS*/
"ALLOC FI(IPFILE) DA('"DSN1"') SHR"
CURRENT=1
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
"EXECIO "HEAP" DISKR IPFILE "CURRENT" (STEM INREC. FINIS"
RCODE=RC
DO I=1 TO INREC.0
INPREC=STRIP(INREC.I,'L',' ');
INPREC=STRIP(INREC.I,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC
END
CURRENT=CURRENT+HEAP;
END
"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT1') SHR";
"EXECIO * DISKW INDSN2 (STEM OUT. FINIS" ;
EXIT;



its not working properly, its not quote at the end.
and when i run next time it is saying
that input file is in use
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 31, 2007 3:03 pm    Post subject:
Reply with quote

Rahul,
Please try this out.

Please empty the output file 'NBK3EYB.FILE.OUTPUT1' before running the following exec.

/*REXX*/
DSN1=NBK3EYB.DSN.OUTPUT2 /*FILE CONTAINS 64716 RECORDS*/
"ALLOC FI(IPFILE) DA('"DSN1"') SHR"
"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT1') MOD";
CURRENT=1
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
"EXECIO "HEAP" DISKR IPFILE "CURRENT" (STEM INREC. FINIS"
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 INDSN2 (STEM OUT. FINIS" ;
END
"FREE F(INDSN)";
"FREE F(INDSN2)";

EXIT;
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 31, 2007 3:04 pm    Post subject:
Reply with quote

Please change "FREE F(INDSN)"; to "FREE F(IPFILE)";
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: Mon Dec 31, 2007 3:19 pm    Post subject: Reply to: Way to remove the quotes from the records
Reply with quote

/*REXX*/
"FREE F(INDSN)";
SAY RC;
DSN1=NBK3EYB.DSN.OUTPUT2 /*FILE CONTAINS 64716 RECORDS*/
"ALLOC FI(INDSN) DA('"DSN1"') SHR"
"ALLOC F(INDSN2) DA('NBK3EYB.FILE.OUTPUT.REXX') MOD";
CURRENT=1
HEAP=40000
RCODE=0;
DO UNTIL RCODE <> 0
"EXECIO "HEAP" DISKR IPFILE "CURRENT" (STEM INREC. FINIS"
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 INDSN2 (STEM OUT. FINIS" ;
END
"FREE F(INDSN)";
"FREE F(INDSN2)";
EXIT;



ITS SHOWING


FILE INDSN NOT FREED, IS NOT ALLOCATED
12
***
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 31, 2007 3:29 pm    Post subject:
Reply with quote

ok...change INDSN to some INDSN5 make sure you use INDSN5 everywhere. In your code, I can see that you are using INDSN at one place and IPFILE at other. Please you allocate, read and close the same file. Otherwise you will end up with these errors.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Mon Dec 31, 2007 3:49 pm    Post subject:
Reply with quote

Quote:
"EXECIO "HEAP" DISKR IPFILE "CURRENT" (STEM INREC. FINIS"
Each time you execute the EXECIO, you open the file, position yourself at "CURRENT", read the lines then close the file.
To obtain a better performance, (the file stays open all the time) try:
Code:
"EXECIO "HEAP" DISKR IPFILE (STEM INREC."


Quote:
INPREC=STRIP(INREC.I,'L',' ');
INPREC=STRIP(INPREC,'T',' ');
J=LENGTH(INPREC)-2;
INPREC=SUBSTR(INPREC,2,J);
OUT.I=INPREC
Consider using this. Everything on the left of the left quote goes to garbage, Everything on the right of the right quote goes as well, quotes are gone too:
Code:
Parse Var INREC.I garb1 "'" Data "'" garb2
OUT.I = Data
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Mon Dec 31, 2007 3:58 pm    Post subject:
Reply with quote

Yes, of course, you alloc INDSN but read IPFILE, that can be a problem too...

Use TRACE R (or TRACE I) and TRACE O to start/stop the trace function.
Place TRACE R right after the /* REXX */
Place TRACE O right before the DO UNTIL (no need to trace 40000 times that part).
Resume tracing after the END of the loop.

Then run and verify TSO return code for you ALLOC, EXECIO and FREE commands.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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