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
 

 

Moving 3 fields into one filed in String manipulation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
madlui56
Currently Banned

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:10 pm    Post subject: Moving 3 fields into one filed in String manipulation
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    Post subject: String manipulation
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
Currently Banned

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:37 pm    Post subject: Elaboration...
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    Post subject: String manipulation
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
Currently Banned

New User


Joined: 08 Aug 2006
Posts: 61
Location: Philippines

PostPosted: Fri Sep 01, 2006 1:59 pm    Post subject: Re: String manipulation
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


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