MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variable Data

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Siddheart22
Beginner


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Mon Oct 03, 2005 9:07 pm    Post subject: Variable Data Reply with quote

Hi,

I have a DB2 unload file which contains a field [besides many others] - NAME-FIELD 100 bytes long.

This field could contain First Name, Last Name, or both. There could be one or more space/s between the first & last names.

E.g. of NAME-FIELD Content:
MR. JOHN HUNKINS
MRS. JEAN LIVINGSTON
MR. LEON B.
MR. YURI SHTEMBERG
MRS. BRIGITTE S.


My question is:
If I want to read every record and move only the data part of the NAME-FIELD excluding the trailing spaces after the last name, which is the most efficient way of doing it?

Thanks in advance,
Siddheart22.
Back to top
View user's profile Send private message
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Tue Oct 04, 2005 12:09 am    Post subject: Reply with quote

Read the variable from right until you read first space character.

01 WS-NAME-CHK PIC X(30).
01 WS-END-OF-FIELD pic x(1)
88 END-FOUND value 'Y'

PERFORM VARYING WS-SUB-NAME FROM
30 BY -1
UNTIL END-FOUND OR WS-SUB-NAME = 0
IF WS-NAME-CHK(WS-SUB-NAME:1) NOT EQUAL TO SPACE
MOVE 'Y' TO WS-END-OF-FIELD
DISPLAY 'LENGTH ' WS-SUB-NAME
END-IF
END-PERFORM

use WS-NAME-CHK(1:WS-SUB-NAME) to move into a variable.
_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Oct 04, 2005 12:31 am    Post subject: Reply with quote

Siddheart22,

Try the following solutions.
http://mvsforums.com/helpboards/viewtopic.php?t=3185&highlight=length

Since you are getting the data from DB2, the solution above might be very useful for you.

Other methods,
http://www.mvsforums.com/helpboards/viewtopic.php?t=525&highlight=length
http://www.mvsforums.com/helpboards/viewtopic.php?t=1282&highlight=length

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Oct 04, 2005 4:48 am    Post subject: Reply with quote

Siddheart22,

Check the function RTRIM to remove the trailing blanks

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.71?SHELF=&DT=20010718164132&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group