View previous topic :: View next topic
|
Author |
Message |
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
what is the picture clause of WK-DTL-LINE-1 ? |
|
Back to top |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
wk-dtl-line-1 does not contain any numeric fields. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|