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
 

 

How to use INITIALIZE verb to replace NUMERIC by SPACES?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Apr 03, 2008 12:21 pm    Post subject: How to use INITIALIZE verb to replace NUMERIC by SPACES?
Reply with quote

I have following record.

01 wk-dtl-rec.
10 WK-DTL-DT-INTR-PD-THRU PIC X(10) VALUE SPACES.
10 WK-DTL-DT-CLM-DLNQ PIC X(10) VALUE SPACES.
10 WK-DTL-AMTL-DSBR PIC ZZZ,ZZZ,ZZ9.99- VALUE ZEROES.

I use the verb,

INITIALIZE WK-DTL-REC REPLACING NUMERIC DATA
BY ZEROES

But i got MAXcc 12.

Can any one suggest me how to do this?

Regards
R.karthik
Back to top
View user's profile Send private message

karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Apr 03, 2008 12:24 pm    Post subject: Reply to: How to use INITIALIZE verb to replace NUMERIC by S
Reply with quote

sorry i use the verb,

INITIALIZE WK-DTL-LINE-1 REPLACING NUMERIC DATA
BY SPACES.

The error i got is,

"INITIALIZE" STATEMENT RECEIVER "WK-DTL-LINE-1" WAS INCOMPATIBLE WITH THE DATA CATEGORY(S) OF THE "REPLACING"
OPERAND(S). "WK-DTL-LINE-1" WAS NOT INITIALIZED.

Regards
R.Karthik
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu Apr 03, 2008 12:33 pm    Post subject:
Reply with quote

what is the picture clause of WK-DTL-LINE-1 ?
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Apr 03, 2008 12:36 pm    Post subject: Reply to: How to use INITIALIZE verb to replace NUMERIC by S
Reply with quote

01 WK-DTL-LINE-1.
10 WK-DTL-DT-INTR-PD-THRU PIC X(10) VALUE SPACES.
10 WK-DTL-DT-CLM-DLNQ PIC X(10) VALUE SPACES.
10 WK-DTL-AMTL-DSBR PIC ZZZ,ZZZ,ZZ9.99- VALUE ZEROES.

Regards
R.Karthik
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Apr 03, 2008 12:43 pm    Post subject:
Reply with quote

wk-dtl-line-1 does not contain any numeric fields.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Thu Apr 03, 2008 12:55 pm    Post subject:
Reply with quote

Quote:
sorry i use the verb,

INITIALIZE WK-DTL-LINE-1 REPLACING NUMERIC DATA
BY SPACES.

The error i got is,

"INITIALIZE" STATEMENT RECEIVER "WK-DTL-LINE-1" WAS INCOMPATIBLE WITH THE DATA CATEGORY(S) OF THE "REPLACING"
OPERAND(S). "WK-DTL-LINE-1" WAS NOT INITIALIZED.


you cannot initialize NUMERIC item with spaces, keep it in mind.

Quote:
INITIALIZE WK-DTL-LINE-1 REPLACING NUMERIC DATA
BY SPACES.


the above syntax must be INITIALIZE WK-DTL-LINE-1 REPLACING NUMERIC DATA BY ZEROS.

and

INITIALIZE WK-DTL-LINE-1 REPLACING ALPHANUMERIC DATA BY SPACES.you can use above commands inside PROCEDURE DIVISION.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Apr 03, 2008 1:18 pm    Post subject:
Reply with quote

you guys sure waste a lot of time. full of answers without bothering to look at the problem.+

there are no numeric fields to be initialized, so why waste time trying to do so?

if you want to be silly and load a numeric field with spaces - when you have a numeric field - then move spaces to the group item.

or as in this case where there are no numeric fields to be initialized, then

INITIALIZE WK-DTL-LINE-1

will satisfy the OP's wishes without cluttering up his/her mind with facts about data types.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Thu Apr 03, 2008 4:55 pm    Post subject: Reply to: How to use INITIALIZE verb to replace NUMERIC by S
Reply with quote

Why not do a plain:
Code:
    MOVE SPACES TO WK-DTL-LINE-1

Also, if you define:
Code:
10 WK-DTL-AMTL-DSBR PIC ZZZ,ZZZ,ZZ9.99- VALUE 0 BLANK WHEN ZEROES.
then the field with have spaces when you do MOVE ZERO TO WK-DTL-AMTL-DSBR
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Apr 04, 2008 10:49 am    Post subject:
Reply with quote

Hi Marso.....

Code:
10 WK-DTL-AMTL-DSBR PIC ZZZ,ZZZ,ZZ9.99- VALUE 0 BLANK WHEN ZEROES


is the above code works with all cobol versions. Because it is an compaq COBOL.

Please let us know whether this commands work with COBOL-85 and COBOL II.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 05, 2008 12:49 am    Post subject:
Reply with quote

I assumed that the OP must INIT the fields repeatedly, so the value clause doesn't help, unless he constructs a model rec and moves that to his active rec in each iteration.
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 if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


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