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
 

 

Reading a particular string from file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Wed Dec 03, 2008 2:08 pm    Post subject: Reading a particular string from file
Reply with quote

hi all,

i need to auotmate a process in rexx as part of the busniess need. in the below image i need to extract the value in the <noofrecords> tag, that is i need to extract the value '1'. Please let me know the rexx code to do this as this is routine work.
Back to top
View user's profile Send private message

sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Wed Dec 03, 2008 2:11 pm    Post subject: Reply to: Reading a particular string from file
Reply with quote

<feeamount>822.00</feeamount>
</feedetail>
<feedetail>
<expensecode>TER</expensecode>
<rateperunit>420.00</rateperunit>
<pricebasis>PA</pricebasis>
<chargedqty>1.00000</chargedqty>
<feeamount>420.00</feeamount>
</feedetail>
</feedetails>
</oceaninvoice>
</oceaninvoices>
<noofrecords>1</noofrecords>
</oceaninvoicedata>
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed Dec 03, 2008 2:16 pm    Post subject: Reply to: Reading a particular string from file
Reply with quote

Code:
string = "<noofrecords>123</noofrecords> "
parse var string "<noofrecords>" number "</noofrecords>"
say number
Back to top
View user's profile Send private message
sun_job

New User


Joined: 18 Sep 2007
Posts: 73
Location: Bangalore

PostPosted: Wed Dec 03, 2008 2:25 pm    Post subject: hi
Reply with quote

but the value <noofrecords>1</noofrecords> will not be the same always
so in that case what wil we do?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Dec 03, 2008 2:50 pm    Post subject:
Reply with quote

Read the file from the start until you encounter a "<noofrecords>".
move the enire record to "string".
Follow the method suggested by enrico.
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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