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: 10274
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: 2284
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 SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 1 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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