View previous topic :: View next topic |
Author |
Message |
sridevi Beginner
Joined: 10 May 2003 Posts: 6 Topics: 3
|
Posted: Sat May 10, 2003 2:38 am Post subject: Rexx |
|
|
Hi,
I have a file and I need to search for a particular string in a file. If the search is successful then I want to get the line number where the string
was located. Then I want to delete all the records from that line number.How can I do this .Please guide me.I want to achieve this
without a sequntial read.
Thanks,
Sridevi |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Sat May 10, 2003 3:15 am Post subject: |
|
|
sridevi,
What if the string is found in mulitple records? You want to delete all the records after the last record? Or, something else? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Sun May 11, 2003 12:42 am Post subject: |
|
|
The best solution I can think of, is something like this Edit-Macro:
Code: |
/* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "FIND 'my string' FIRST"
ADDRESS ISREDIT "(CURRLINE) = LINENUM .ZCSR"
ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZLAST"
ADDRESS ISREDIT "LABEL &CURRLINE = .A"
ADDRESS ISREDIT "LABEL &LASTLINE = .B"
ADDRESS ISREDIT "DELETE .A .B"
EXIT |
________
smoke weed every day
Last edited by ofer71 on Sat Feb 05, 2011 10:56 am; edited 1 time in total |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Sun May 11, 2003 2:57 am Post subject: |
|
|
OK... I'm feeling picky :
Quote: |
ADDRESS ISREDIT "(CURRLINE) = LINENUM .ZCSR"
ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZLAST"
ADDRESS ISREDIT "LABEL &CURRLINE = .A"
ADDRESS ISREDIT "LABEL &LASTLINE = .B"
ADDRESS ISREDIT "DELETE .A .B"
EXIT
|
That is a lot of unnecessary assigning. Why not just use
Code: | Address isredit "del all .zcsr .zlast" |
|
|
Back to top |
|
|
sridevi Beginner
Joined: 10 May 2003 Posts: 6 Topics: 3
|
Posted: Mon May 12, 2003 7:52 am Post subject: |
|
|
Hi ,
Thanks for your information . Edit macro is not working for a file having large amount of data.While using a macro for huge file , I am getting the message "browse subsituted " for a file.Please is there is anyother way to achieve this.
One more question is it possible to delete a record using EXECIO command? Please guide me.
Thanks,
Sridevi |
|
Back to top |
|
|
sridevi Beginner
Joined: 10 May 2003 Posts: 6 Topics: 3
|
Posted: Mon May 12, 2003 8:15 am Post subject: |
|
|
Hi,
Is there any way to set "end of file "condition for a file using
EXECIO.
Assume that there are 1 to 10 records in a sequential file.
and I want to set EOF at 6 th record.Is it possible to do this using EXECIO.
Thanks,
Sridevi |
|
Back to top |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Mon May 12, 2003 10:46 pm Post subject: |
|
|
You can use EXECIO to read a speciific number of records e.g.
"EXECIO n DISKR ddname (STEM input."
where n is the number of lines to be read, ddname is the ddname that the file is allocated to and input. the stem into which the data is placed. You can then traverse input.1-input.n. e.g.
Do i = 1 to n
Say input.i
End
Subsequent EXECIO's continue from the next record not already read. Not exactly setting EOF, but then again there is only one real EOF. It still achieves what I think you are trying to achieve. _________________ Regards,
Mike. |
|
Back to top |
|
|
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Mon May 12, 2003 11:18 pm Post subject: |
|
|
With EXECIO, after the ddname, you can specify the starting record to read from.
________
Suzuki FXR150 specifications
Last edited by ofer71 on Sat Feb 05, 2011 10:56 am; edited 1 time in total |
|
Back to top |
|
|
sridevi Beginner
Joined: 10 May 2003 Posts: 6 Topics: 3
|
Posted: Fri May 16, 2003 11:19 pm Post subject: |
|
|
Hi all,
Thanks for ur information . Since my input file so huge , its difficult to load into stem.So as you said I thought of using EXECIO with skip command..so that it will skip some of the records.. Then start processing from the next record till end of file.
"EXECIO 1 DISKRU INDD1 1300 " (LIFO"
PULL LINE
PUSH '**********'
"EXECIO 1 DISKW INDD1"
Here I am skipping first 1299 record read .Start reading from 1300 record onwards. But here instead of deleting the records from 1300 , I am just making ********** to the records . Then again in sort I am omiting this ********(unwanted records) ...Is it possible to delete a record thru EXECIO.
Thanks,
Sridevi |
|
Back to top |
|
|
coolman Intermediate
Joined: 03 Jan 2003 Posts: 283 Topics: 27 Location: US
|
Posted: Tue May 20, 2003 3:45 am Post subject: |
|
|
Sridevi,
Here is a SORT solution.It will be definitely faster than the other solutions. If you have SYNCSORT, then change the program name to SYNCTOOL.
Code: |
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//OUT1 DD SYSOUT=*
//IN1 DD *
@A 1 @ABC 212 @XYZ 43746
@A 2 @DEF 646 @XYZ 293238923
@A 4 @B 3 @GRP 718 @XYZ 9459458
@A 1 @FDF 718 @XYZ 096567454857
@A 1 @DFG 408 @XYZ 454857
@A 1 @DFG 408 @XYZ 454857
@A 1 @DFG 408 @XYZ 454857
/*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN1) TO(OUT1) USING(CTL2)
/*
//CTL1CNTL DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
OUTFIL FNAMES=CTL2CNTL,INCLUDE=(1,80,SS,EQ,C'@FDF 718'),
OUTREC=(C' OPTION STOPAFT=',81,8,80:X)
/*
//CTL2CNTL DD DSN=&TN,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//
|
Here the string to be searched is "@FDF 718", change it to your Search string and execute the job.
Hope this helps...
Cheers,
Coolman.
P.S : I have assumed your Input File to 80 FB.
________
L platform
Last edited by coolman on Sat Feb 05, 2011 1:20 am; edited 2 times in total |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue May 20, 2003 11:00 am Post subject: |
|
|
Oops, Coolman !
You missed out couple of things.
The first statement is a COPY statement for IN. Since, you do not have a TO coded in the COPY statement, DFSORT will expect a DD name as CPY1OUT. This is missing. So, the job would abend with MAXCC 16.
Secondly, CTL2CNTL is pointing to a dataset with DISP=(,PASS) i.e. DISP=( NEW,PASS). It must point to it with DISP=(SHR,PASS) with the VOL, REF as well (as it is a temp dataset). _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Tue May 20, 2003 5:10 pm Post subject: |
|
|
cogito,
coolman did not miss any thing. Take a closer look at the the following statement
OUTFIL FNAMES=CTL2CNTL,INCLUDE=(1,80,SS,EQ,C'@FDF 718'),
By coding like that coolman is creating a dynamic control card on the fly which he is using for the second copy statement.
Since the control card is being created dynamically, the disp=(,pass) is translated as disp=(new,pass,delete). Since there are no steps following this step which would receive the control card , the dataset will be deleted at the end of copy step.
Coolman did have a flaw. He did not allocate OUT2 dataset.I guess he meant OUT1.His toolin copy stmt refers to OUT2 , but in the JCL he had OUT1 allocated.
Cogito try running coolman's solution and see if it abends as you stated.
kolusu |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue May 20, 2003 10:44 pm Post subject: |
|
|
Sorry Coolman. My mistake. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
|
|