|
Rich Duzenbury wrote:
Uh, yeah, I kind of gathered. I'm trying to figure out why (Hans?) such a restriction is in place. It seems a bit silly. Kind of like not being able to level break (cycle) on a binary field. I did find out that after V4R5 it gets easier, as the %char bif can supposedly take an additional parameter for the conversion format. At 05:30 AM 10/4/02, you wrote:VARRYING is not allowed with this date conversion. it should be fixed length character variable... Be ignorant than urban insane Smile :-) from your Heart > -----Original Message----- > From: Rich Duzenbury [SMTP:rduz=6xRnKaLersmyXaTedYSxiUEOCMrvLtNR@public.gmane.org] > Sent: Friday, October 04, 2002 2:51 AM > To: rpg400-l=Zwy7GipZuJhWk0Htik3J/w@public.gmane.org > Subject: Compile error - why? > > Hi, > > I'm getting a compile error on this. What is that rationale for not > allowing one to move from a date field into a VARYING alpha field? This > machine is on V4R5, btw. Now it looks like I'll have to declare a > non-varying field to accept the data, and then do an extra move or eval to > get the data over into $tagval. > > D work_date S D > D $tagval s 512 VARYING > C *usa movel work_date $tagval > > *RNF7560 30 1 Variable-length field is not allowed with this > operation. > > Curious.
Why is this restriction in place? First, let's review the rules for using varying length character variables in the fixed-form calc specs. When developing the varying functionality, we agonized a while over the issue of how to provide some sort of meaningful use of varying length variables in the calc specs. It was a problem due to the weird semantics of the MOVE and MOVEL operations (among others). For example, when moving a short Factor 2 operand to a longer Result Field operand using MOVE, the left-most characters are left unmodified. We tried coming up with rules that made sense using varying length fields, but attempts resulted in rather ornery and complex rules. And so, we adopted the general principle that any varying length variable coded in fixed-format calcs would be treated as a fixed length variable field defined with the current length. One simple rule - fixed-form calcs means varying length variables are treated as fixed length. So on to date variables. You know there's a rule that when moving a character variable to a date variable, the character variable must be long enough to hold a date value (or vice versa). The problem with a varying length variable is that at compile time we don't know if the variable will have a current length at run-time long enough to hold a date value. And so we disallow all varying length variables in date, time, and timestamp MOVE operations. I suppose you could argue that we could add a check at run-time, and I suppose that's true. But since there were alternatives, we decided not to do that extra work. Now, with V5R1, there are even more expression alternatives to do D/T/Z manipulation. (Oh BTW, if you want to do level breaks on integer input fields (or any other of the unsupported types), just define a character field in that field position, and code the level indicator on that field.) Cheers! Hans
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.