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

Need Logic for COBOL Move


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

New User


Joined: 08 Dec 2007
Posts: 6
Location: bangalore

PostPosted: Sat Dec 08, 2007 3:40 pm
Reply with quote

Hi,

There are 8 address lines
addr-1
addr-2
addr-3
addr-4
addr-5
addr-6
addr-7
addr-8

Now i need to move addr-1 to addr-2 similarly for all other and
ws-special-name to addr-1.
While moving if any occurrences of address -line-x(x=1-8) are spaces then move up by 1 occurrence(addr-1 to addr-2 ,addr-2 to addr-3) e.g if addr-2 = spaces then addr-3 should be moved to addr-3.
Back to top
View user's profile Send private message
mahesh bhavikatti

New User


Joined: 08 Dec 2007
Posts: 6
Location: bangalore

PostPosted: Sat Dec 08, 2007 5:01 pm
Reply with quote

Please let me know incase incase the query is not clear.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sat Dec 08, 2007 5:43 pm
Reply with quote

Mahesh,

Quote:
Please let me know incase incase the query is not clear.

You are correct. Need some examples also.
Back to top
View user's profile Send private message
mahesh bhavikatti

New User


Joined: 08 Dec 2007
Posts: 6
Location: bangalore

PostPosted: Sat Dec 08, 2007 6:35 pm
Reply with quote

ex values of the address are
addr1 = mahesh
addr2= kumar
addr3= bhavika
addr4= spaces
addr5= spaces
addr6= cross
addr7= house
addr8= pincode

ws-special-name = bank, This will be moved to addr1 so the values i need is

addr1 = bank
addr2= mahesh
addr3= kumar
addr4= bhavika
addr5= cross
addr6= house
addr7= pincode
addr8= spaces(For addr8 if value is there then we can move or else default it will be spaces)

Hope this helps ...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Dec 09, 2007 2:52 am
Reply with quote

Hello,

Are all of the addr fields the same length? If they are, you could define one array of the 8 input values and another array to build the output values.

Move spaces to the output array.

Your process would check the "special" name and if it is not blank, move that value to the first occurance of the output array (and set the current output index/subscript to the second entry).

The input array "current" occurance would be checked for spaces and if not, moved to the current output occurance. Both index/subscript values woule be incremented.

If the "input" value was spaces, the input array would be incremented with no move to the output array (and no output array increment).

Continue like this until done with the input array. When all of the input array has been processed, the final values are in the output array.
Back to top
View user's profile Send private message
mahesh bhavikatti

New User


Joined: 08 Dec 2007
Posts: 6
Location: bangalore

PostPosted: Sun Dec 09, 2007 10:58 am
Reply with quote

Thank you .... D.sch
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 10, 2007 12:11 am
Reply with quote

You're welcome icon_smile.gif

We're here if there are questions.

d
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top