Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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: 2285
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us