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

Justification of Alphanumeric variable with Numeric data


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

New User


Joined: 10 May 2005
Posts: 10
Location: india

PostPosted: Thu Jan 04, 2007 3:13 pm
Reply with quote

I have a Alphanumeric variable of X(25), In which variable values can come. Suppose value 1234567890 comes , i have to pick only last 4 digits of this incoming variable and mask the rest with "*" .
it should be like ******7890and rest spaces.

Can anyone help me what code i should use ?
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Thu Jan 04, 2007 3:35 pm
Reply with quote

A similar question has been posted before. Check this topic and adjust to your needs.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 04, 2007 3:36 pm
Reply with quote

OK, you explain that the field is 25 bytes long and might have a 10 digit number in it. what else fills out the other 15 bytes, leading or trailing blanks?
Additionally, you imply that sometimes the number might be different lengths, correct?
Back to top
View user's profile Send private message
rohit_raajin

New User


Joined: 10 May 2005
Posts: 10
Location: india

PostPosted: Thu Jan 04, 2007 3:44 pm
Reply with quote

The rest of the bytes will have trailing spaces.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 04, 2007 3:54 pm
Reply with quote

Assuming the number has no leading or imbeded blanks, something like:
unstring inarea into outarea delimited by space count in cnt followed by move all '*' to outarea (1:cnt-4) should do it.
Back to top
View user's profile Send private message
adarsha

New User


Joined: 28 Dec 2006
Posts: 8
Location: Noida,Delhi

PostPosted: Thu Jan 04, 2007 5:31 pm
Reply with quote

rohit_raajin wrote:
I have a Alphanumeric variable of X(25), In which variable values can come. Suppose value 1234567890 comes , i have to pick only last 4 digits of this incoming variable and mask the rest with "*" .
it should be like ******7890and rest spaces.

Can anyone help me what code i should use ?


hi,

Its Adarsh,

according ur requirement i can guess that, u need one more variable say Var2, declared with sign clause and no *'s u need in Value clause..

then use reference modification
Move Var1(start Pos;end Pos) to Var2...!!!!
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top