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

Spacing out the word & adjusting space bween remaining c


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

Moderator Emeritus


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

PostPosted: Tue Dec 22, 2009 8:05 pm
Reply with quote

Hello,

Quote:
You need to decide up on the size of WS-ADDR-PART4. Especially size of "<number/alphabet till spaces>".
I believe not. . .

The code needs to be more flexible. It is not a good idea to dictate to the users what the "real" data will be. We (as developers) need to meet their need. . . We implement the business rules, not define them. . .

imho
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Dec 22, 2009 8:19 pm
Reply with quote

Quote:
We implement the business rules, not define them. . .

Depends upon how heavily armed you are, Dick. icon_lol.gif
Back to top
View user's profile Send private message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Tue Dec 22, 2009 9:15 pm
Reply with quote

Lijo,

That is the problem. The P.O. BOX can come as following:
P.O. BOX A
P.O. BOX 234
P.O. BOX 11050
P.O. BOX 12

So I need to allocate WS-ADDR-PART4 atleast 20 bytes. We are declaring the WS variable not dynamically, right. So I am confused how we can decide upon the WS variable PIC size based on the data.
Can you please explain in detail. Sorry for that.

Thanks
Vinu
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Dec 22, 2009 9:20 pm
Reply with quote

Can there be more than 1 space between "P.O." and "BOX"?
Back to top
View user's profile Send private message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 179
Location: India

PostPosted: Tue Dec 22, 2009 9:29 pm
Reply with quote

Hi all,

I think the below code did the trick

Before the last line of code posted by Lijo, I have added this line of code to find the data length of P.O. BOX <num/alphabet>
i.e., after getting the P.O. BOX <num/alphabet> in WS-ADDRESS-POST4

Code:
INITIALIZE K                               
PERFORM VARYING K FROM 35 BY -1           
  UNTIL WS-ADDRESS-POST4(K:1) NOT = SPACES
  CONTINUE                                 
END-PERFORM                               
INSPECT WS-DESC-CHK REPLACING ALL 
        WS-ADDRESS-POST4(1:K) BY SPACES


I have tested and this works fine.
Thanks Lijo, Dick for your great amount of time and support.

Thanks
Vinu
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Dec 22, 2009 9:33 pm
Reply with quote

The United States Post Office has a publication, number 28, that specifies everything you care to know about addresses. An address line, which could be a P.O. Box number, is recommended to be 30 bytes although 64 is considered optimum by the Post Office. If I recall correctly -- and I'm not sure I do -- 16 bytes is the absolute minimum you're allowed to use to meet U.S.P.S. standards.
Back to top
View user's profile Send private message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Wed Dec 23, 2009 10:13 am
Reply with quote

Quote:
I think the below code did the trick


Good work Vinu...
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 Goto page 1, 2  Next

 


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 Search two or more word with FILEAID Compuware & Other Tools 15
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
Search our Forums:

Back to Top