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

Moving 3 fields into one filed in String manipulation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madlui56

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:10 pm
Reply with quote

Hello,

I just want an assisstance with this problem.

We have a field that takes three values.
These values have different lengths.
Example:
1.00 NAME ADDRESS
98.00 NAME ADDRESS
123.00 NAME ADDRESS

Question : How do we move these three fields (where the first field has a variable length) to just one field? In this sense, there is only one space after the first field then the second field then a space then the third.

Thanks!
Back to top
View user's profile Send private message
sarunkumaar

New User


Joined: 31 Aug 2006
Posts: 15
Location: Chennai, India

PostPosted: Fri Sep 01, 2006 1:35 pm
Reply with quote

Use UNSTRING statement to move the fields into 3 different fields with space as delimiter.

i.e get the record value into some field like WS-FIELD having the value of 1.00 NAME ADDRESS

Then use

UNSTRING WS-FIELD DELIMITED BY SPACES INTO WS-FIELD01 WS-FIELD02 WS-FIELD03

Where the fields WS-FIELD01 Will have the value 1.00 and WS-FIELD02 will have NAME and WS-FIELD03 will have ADDRESS
Back to top
View user's profile Send private message
madlui56

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:37 pm
Reply with quote

Hello just to elaborate above problem,

I do have 3 fields there for example.. 1.00 (amount)(space)Name

The question is How can I make the first field to have a single space every after its value regardless of its different length...?

Example: 100.00(single space)(field)

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

New User


Joined: 31 Aug 2006
Posts: 15
Location: Chennai, India

PostPosted: Fri Sep 01, 2006 1:48 pm
Reply with quote

Sorry again if i misunderstand your question..

You can use STRING function to append the value with space irrespective of it's length.

STRING WS-AMOUNT SPACE WS-NAME SPACE WS-ADDRESS DELIMITED BY SIZE INTO WS-FIELD
Back to top
View user's profile Send private message
madlui56

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:59 pm
Reply with quote

gREAT..! Thanks so much for the idea.
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 -> COBOL Programming

 


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 file manager is doing string conversion IBM Tools 3
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top