MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to extract using cobol & easytrieve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
gupta
Beginner


Joined: 12 Feb 2005
Posts: 27
Topics: 15

PostPosted: Mon Feb 14, 2005 2:09 am    Post subject: how to extract using cobol & easytrieve Reply with quote

hi,

I have an req that i have to read the section of data from an input file
The input file is an VB of 32106 bytes.

INPUT-FILE DATAS;
<WAA>BND460000300*J880*L090205*WSXSA08120073*Z997*<STA>A803*OEMP*MBNU*T<GAA>
<WAA>BND460007495*J880*L090205*Q465654325*WSXSA08140147*Z997*<STA>A803*OEMP*MBNU*<GAA>
<WAA>BND460007693*J880*L090205*WSXSA08074718*Z997*<STA>A123*O000*MBNU*<GAA>
<WAA>BBD460012206*J880*L281004*WSXSA08044307* <STA>A803*M803*O803*U <GAA>

each record starting with <WAA> tag

A parameter will be passed stating read the data from '<WAA>' . I need to find the location and from there i have to read till i find '<' tag.

Then i have to seperate the information.
can anyone tell me a simple logic so that it can be implemented in
cobol & easytrieve

Thanks
Back to top
View user's profile Send private message
powerhawk
Beginner


Joined: 08 Nov 2004
Posts: 28
Topics: 4
Location: Stockholm

PostPosted: Mon Feb 14, 2005 5:49 am    Post subject: Reply with quote

I understand the task like this:
A parameter will give you the start tag, in the sample above it's <WAA>. The start tag can have any length, not just 5 characters. You want the data string from the character after the start tag till the next '<' character.

Here is a COBOL solution:

Initialize A-TAGLENGTH ( S9(4) COMP. )
inspect A-PARAMETER tallying A-TAGLENGTH for characters before initial spaces

Initialize A-STRINGSTART ( S9(4) COMP. )
inspect A-RECORD tallying A-STRINGSTART for leading A-PARAMETER(1:A-TAGLENGTH)
add A-TAGLENGTH to A-STRINGSTART

UNSTRING A-RECORD DELIMITED BY '<'
into A-STRING
with pointer A-STRINGSTART
END-UNSTRING

If the file records is in real XML (don't seems to be here) you can use the XML parse funktion instead.
Back to top
View user's profile Send private message Send e-mail
gupta
Beginner


Joined: 12 Feb 2005
Posts: 27
Topics: 15

PostPosted: Mon Feb 14, 2005 6:33 am    Post subject: Reply with quote

Thanks powerhawk.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group