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

How to remove High-values in the Alphamumeric field


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

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Mon Jul 06, 2009 12:10 pm
Reply with quote

Hi,
Could anyone please tell me how to remove high-values and leading zeros in the alpha numeric field?

Input layout:
---------------
01 Ws-Name Pic X(04).

INput Values
--------------
David
0John
"FFFF
FFFF" -> High values in Hex decimal format

Output layout:
----------------
01 ws-name-output Pic X(04)

Values
-------
David
John - (Leading zeros in the input were removed)
SPACES - (Spaces were moved when high values in the input)
Back to top
View user's profile Send private message
bhairon singh rathore

New User


Joined: 19 Jun 2008
Posts: 91
Location: banglore

PostPosted: Mon Jul 06, 2009 12:18 pm
Reply with quote

hi,

Why don't you INSPECT leading zeroes and X'00' and replace it with spaces.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 06, 2009 12:20 pm
Reply with quote

The INSPECT REPLACING statement should do the job.
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Mon Jul 06, 2009 12:42 pm
Reply with quote

Yes you are correct. The Inspect statement will replace zeros and H'00' with spaces. but the requirement is something like

Input - Output
0TATA -> TATA (Zero was removed and moved a step forward)
00NAN -> NAN (Zeros were removed and moved 2 steps forward)
"FFFF
FFFF" -> SPACES (High values will be spaces)
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: Mon Jul 06, 2009 2:52 pm
Reply with quote

Reference modification -- the COBOL Language Reference manual will give you the details.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 06, 2009 5:24 pm
Reply with quote

Click on this link -

ibmmainframes.com/viewtopic.php?p=143786&highlight=#143786

Although the result of the above link is a left-justified value, adapting the logic to right-justification should not be too much of a chore.

Regards,
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: Mon Jul 06, 2009 5:27 pm
Reply with quote

This sounds like another student exercise. Especially since the data conflicts with the problem statement:
Quote:
01 Ws-Name Pic X(04).
versus
Quote:
David
0John
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 Jul 06, 2009 8:22 pm
Reply with quote

Quote:
This sounds like another student exercise.
And we get more and more of these.

In addition to the student forum, www.ibmmainframeforum.com
maybe we need a "Homework Questions" section similar to the "Interview Questions" section. That way we could at least gather the student/beginner questions in one place.

fwiw,

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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remove leading zeroes SYNCSORT 4
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top