IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need help in string formatting


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ssundaram

New User


Joined: 22 Jan 2007
Posts: 8
Location: USA

PostPosted: Fri Feb 22, 2008 9:38 pm
Reply with quote

Code:

  EX1  66521 TEST RD 
  EX1  999   TEST RD
  EX2  13409 E STAR CREEK RD
  EX3  PO BOX 985


The above sre three types of my input records.
For EX1 I Need to exclude number in front (66521,999) and write only the word after the space.

For Ex2: I need to write the word after the single character in ouput.

For Ex3: I need to write as inthe input

Can anyone guide me on this

Thanks
Satya
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Feb 22, 2008 9:48 pm
Reply with quote

This looks more like a programming solution.
I'd use a perform loop with reference modification and scan input until one of the three rules had been satisfied, then just move the remainder.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 22, 2008 10:16 pm
Reply with quote

Satya,

It isn't clear what you want to do.

Are all of these input records in the same file, or are the EX1, EX2 and EX3 records in different files?

The rules you give are quite vague. It would help if you showed the expected output records.

For EX1, does the word you want to extract always start in the same position as shown in your example records, or is it more complicated than that? Is the pattern of the records always a number followed by a word, or can it be some other pattern?

For EX2, what is the pattern? Is the single character always an E or can it be any character? Is the single character always the second "word"?

You really need to do a better job of explaining the rules, and the pattern of the records before anyone can help you. Also, show better examples of input and output.
Back to top
View user's profile Send private message
ssundaram

New User


Joined: 22 Jan 2007
Posts: 8
Location: USA

PostPosted: Fri Feb 22, 2008 11:26 pm
Reply with quote

Frank,

All the examples are there in the same input file. Basically what I require is for EX1 ,I need the word that follows the number and space which is not fixed.
For Ex2: I need the word that follows the number, space, single caharacter,space and the postion and value are not fixed.

Sorry for not being explanative.

Thanks
Satya
Back to top
View user's profile Send private message
ssundaram

New User


Joined: 22 Jan 2007
Posts: 8
Location: USA

PostPosted: Fri Feb 22, 2008 11:31 pm
Reply with quote

Frank,
Here are the input and corresponding output i require

Input:

Code:

1100 TEST
100 SATYA
10 W HARISH
PO TEST


OUTPUT:
Code:

TEST
SATYA
HARISH


Thanks
Satya
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 22, 2008 11:52 pm
Reply with quote

Sigh. The patterns still aren't clear. Do you want to handle the records differently depending on their relative record number, that is, handle records 1 and 2 as EX1, handle record 3 as EX2 and handle record 4 as EX3, or are there some other rules for the pattern that indicates how a record should be handled?

Think of this in programming terms. You need a set of IF/THEN conditions to identify how each record should be handled, e.g.

IF (pattern1) THEN ...
IF (pattern2) THEN ...
...

and you need to describe the patterns. Is the pattern for EX1 a number followed by a word, or two words, or something else? Is the pattern for EX2 a number followed by a single character followed by a word, or something else?

What about EX3 ... you said "For Ex3: I need to write as inthe input" but you don't show the last input record in the output. Why? And if you do want it in the output, what is the pattern for EX3 ... is it a non-numeric followed by a word or something else?

You can't just throw out some vague requirement and expect somebody to tell you how to do it. You have to give clear requirements to get the correct result. That's a basic skill of programming. If you can't give clear requirements, then nobody can help you.

I suspect you can use DFSORT's PARSE function to do the kind of thing you want to do. You can read about DFSORT's PARSE function here:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top