Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to move spaces to a numeric field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Need to move spaces to a numeric field
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    Post subject:
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    Post subject: Reply to: Need to move spaces to a numeric field
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    Post subject:
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

Senior Member


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

PostPosted: Fri Sep 26, 2008 1:12 pm    Post subject:
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri Sep 26, 2008 5:01 pm    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 26, 2008 10:26 pm    Post subject:
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    Post subject: Reply to: Need to move spaces to a numeric field
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    Post subject: Reply to: Need to move spaces to a numeric field
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us