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: 10211
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: 2180
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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