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

Need to move spaces to a numeric field


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

New User


Joined: 30 Mar 2007
Posts: 7
Location: Chennai

PostPosted: Fri Sep 26, 2008 11:01 am
Reply with quote

Hi All,

A report getting created out of mainframe is displaying page number. The page number is defined as a numeric field. My requirement is to display blanks instead of the page number.

The definition of the field is as given below.

01 HEADER1.
05 FILLER PIC X(75).
05 PAGE1 PIC 9(05).
05 FILLER PIC X(52).

I am planning to redefine the field PAGE1 with PAGE2 and define the field as alphanumeric as follows:

01 HEADER1.
05 FILLER PIC X(75).
05 PAGE1 PIC 9(05).
05 PAGE2 REDEFINES PAGE1.
10 WS-PAGE1 PICX(05) VALUE SPACES.

05 FILLER PIC X(52).

and then move spaces to this field PAGE2.

Please let me know if this would work.

Thanks in Advance.

Regards,
Elango
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Sep 26, 2008 11:27 am
Reply with quote

Have you tried running it?
Surely you should get errror.
it will work if you remove value clause and move spaces in procedure division.
Back to top
View user's profile Send private message
elangovan_paul

New User


Joined: 30 Mar 2007
Posts: 7
Location: Chennai

PostPosted: Fri Sep 26, 2008 11:41 am
Reply with quote

Have not ran the job yet Sambhaji...

Oh you mean to say that we can not move spaces to a variable that has been initialized with spaces already...

I shall try and let you know the outcome.

Thanks anyway.

Regards,
Elango
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Sep 26, 2008 11:46 am
Reply with quote

Quote:

Oh you mean to say that we can not move spaces to a variable that has been initialized with spaces already...

i dont mean that. I mean it will give compilation error when you try to use value clause in redefined variable. so you have to remove that and move spaces to variable in procedure division
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Sep 26, 2008 1:12 pm
Reply with quote

Hi,

You can use reference modification. The compiler will then treat your display-numeric field as alphanumeric. The field length is not necessary.
Code:
03  PAGE1 PIC 9(05). 

MOVE SPACES TO PAGE1 (1:). 

BEWARE..Just don't put your name to it. Many sites compare it with an "excercise" which "can" be done by male dogs & they don't like it...They may send a search and destroy team after you.. icon_lol.gif
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 Sep 26, 2008 5:01 pm
Reply with quote

Or you could define PAGE1 as PIC Z(05) and move zero to it before printing.
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 Sep 26, 2008 10:26 pm
Reply with quote

Hello,

Is the page number needed part of the time and spaces need part of the time? If the need for the page number has been completely removed, i'd suggest removing the field and declaring the header as spaces.

Where/how is the page number being incremented? If the page number is still needed part of the time and the field in the header is being incremented, moving spaces there could be a problem.

FWIW.
Back to top
View user's profile Send private message
ramakrishnag

New User


Joined: 10 Sep 2008
Posts: 6
Location: india

PostPosted: Sat Sep 27, 2008 8:12 pm
Reply with quote

Hi

You can directly define the Page number as X(05) value spaces.

It is editing variable. before print command you can pass the numeric page number to this alpha-numeric variable.

If you dont want to print the page number then dont pass the numeric value in this page variable then it will be any way value is space by defalut.

Thanks,
Rama
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Sun Sep 28, 2008 4:09 am
Reply with quote

Remove the VALUES SPACES.
Move SPACES TO WS-PAGE1.

***BUT*** before you do any ADD to PAGE1
YOU MUST MOVE ZEROS TO PAGE2 or WS-PAGE1.
05 PAGE1 PIC 9(05).
05 PAGE2 REDEFINES PAGE1.
10 WS-PAGE1 PICX(05) VALUE SPACES
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top