Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in occur clause for date field.

Status
Not open for further replies.

shaily123

Programmer
Feb 5, 2005
17
US
Hi,

I have a field REFILL_DATE of type Number and size 128. It contains 16 date in format ddmmyyyy. To define it in file i have written below code.

BUT it is giving error saying numeric value can maximum go up to 35. Can not define. error in line pic 9(128).


Can any one help....

01 stored_area.
05 Refill_dates pic 9(128).
05 refill_date REDEFINES refill_dates.
10 refill_date_1 pic 9(8).
10 refill_date_2 pic 9(8).
10 refill_date_3 pic 9(8).
10 refill_date_4 pic 9(8).
10 refill_date_5 pic 9(8).
10 refill_date_6 pic 9(8).
10 refill_date_7 pic 9(8).
10 refill_date_8 pic 9(8).
10 refill_date_9 pic 9(8).
10 refill_date_10 pic 9(8).
10 refill_date_11 pic 9(8).
10 refill_date_12 pic 9(8).
10 refill_date_13 pic 9(8).
10 refill_date_14 pic 9(8).
10 refill_date_15 pic 9(8).
10 refill_date_16 pic 9(8).
 
Thats correct.

The maximum allowed is either 18 or 31 depending on the compiler.

Change the pic 9(128) to be pic X(128), and then workd with the subdefinitions.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Why not simply this ?
01 stored_area.
05 Refill_dates.
10 refill_date pic 9(8) occurs 16.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for your reply.

But If I store numeric value in alphanumeric then how it will effect data.

And do I have to change redefine also from 9 to X. Or rest kepp the same and program will work fine.
 
Unless you are using the BIG field on it's own redefines as PIC X on your particular case will not affect data.

And no you only change the one I mentioned, not the others.


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Shaily -

Storing the data in an alphanumeric field will have no effect what so ever on the data, since you're actually referring to it through the redefined fields which are numeric. If you were dealing with fractions, though, you'd have to be careful about using the period.

The only thing I would worry about (even though it's not your case) is if Refill_dates had an alignment clause on it. I don't know if all compilers allow this, but you can sometimes specify in working storage whether the data in the alphanumeric field is right of left aligned. If you play around with that, the redefined fields might not represent what you intend them to.

But you don't seem to be doing that, so you should be good with the advice given by the other members.

.DaviD.
 
Personally, I don't think it's a good idea to define dates as numeric unless you intend to perform arith on them.

We don't break up "123 6th Ave." into numeric and alpha items.

Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top