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

Initialize a variable keeping data as it is before


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

New User


Joined: 24 Aug 2006
Posts: 2
Location: pune

PostPosted: Fri Nov 16, 2012 12:32 am
Reply with quote

Hi, I have a requirement where i need to map A PIC X(20) to B X(20)...A can have data as well as low values... '1234.....'. How do I remove the low values from A before the moves...I have a copybook with many fields potentially having data and low values in them..Is there a way to initialize A keeping data as it is before the moves or some other way?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Nov 16, 2012 12:41 am
Reply with quote

What about INSPECT REPLACING?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Nov 16, 2012 12:42 am
Reply with quote

Why do you feel it necessary to initialize a field which will then have a value assigned to it?
Back to top
View user's profile Send private message
vikas.b

New User


Joined: 24 Aug 2006
Posts: 2
Location: pune

PostPosted: Fri Nov 16, 2012 12:51 am
Reply with quote

We donot want any low values in destination field. same case with numeric if source has low values then it should be replaced with zeroes...

Will inspect replace low values with spaces in Xnumeric fields n with zeroes in numeric?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Nov 16, 2012 12:52 am
Reply with quote

Akatsukami wrote:
Why do you feel it necessary to initialize a field which will then have a value assigned to it?


Better reread the TS initial post!
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Nov 16, 2012 1:07 am
Reply with quote

Craq Giegerich wrote:
Akatsukami wrote:
Why do you feel it necessary to initialize a field which will then have a value assigned to it?


Better reread the TS initial post!

It's a bit unclear to me. Am I to understand that what is going to be done is to move A to B, or B to A?
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: Fri Nov 16, 2012 1:20 am
Reply with quote

Are you talking about CICS map fields or variables in a batch program?
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: Fri Nov 16, 2012 1:51 am
Reply with quote

Hello and welcome to the forums,

As you can see from the replies, different people have a different understanding of what you want to do (and you thought it was a simple question, right icon_wink.gif ).

Suggest you post the rules of what you want by using a few examples. Show what you can "have" and what "output" (data field content) is wanted.

If a field has some "good" characters and some "bad" ones, what is the rule for handling these?

Why is there this kind of data in the input file? Possibly "fixing" the process that creates the file should be considered?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 16, 2012 2:31 am
Reply with quote

vikas.b wrote:
We donot want any low values in destination field. same case with numeric if source has low values then it should be replaced with zeroes...

Will inspect replace low values with spaces in Xnumeric fields n with zeroes in numeric?


INSPECT is only able to do what you ask it to do. There is a link to IBM manuals at the top of the page, including the Cobol manuals.

It seems from what you have shown so far that the low-values are "trailing". Unless they represent zeros in a number, it would be a bad idea to change them to zeros.

You need to follow Dick's advice and show explanatory sample data. You may need INSPECT for the alpha-numeric values (and FUNCTION REVERSE if you only need to remove trailing low-values but preserve leading or embedded ones) and UNSTRING for the numeric values. So how do you know which is which? They are both in the same field...
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 Store the data for fixed length COBOL Programming 1
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
Search our Forums:

Back to Top