For Programmers: Free Programming Magazines  


Home > Archive > Cobol > March 2007 > FUNCTION and reference modification









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author FUNCTION and reference modification
Roger While

2007-03-17, 6:55 pm

Intersting, (alphanumeric) FUNCTION's can be ref-modded.
OK. I can see the point of getting some
subset of eg. CURRENT-DATE.

Interesting is, however, using ref modding on a
variable length return field.
eg.
MOVE FUNCTION TRIM (MYFLD) (1:1) TO ..

Note that TRIM can (AFAIKS) can return a zero
field length.
Yes, of course, one can test the field for spaces.
The question is what should happen with the move ?
Yes, Rick, I know that ref modding can return
an exception code.


Rick Smith

2007-03-17, 6:55 pm


"Roger While" <simrw@sim-basis.de> wrote in message
news:ethcp2$kce$00$1@news.t-online.com...
> Intersting, (alphanumeric) FUNCTION's can be ref-modded.
> OK. I can see the point of getting some
> subset of eg. CURRENT-DATE.
>
> Interesting is, however, using ref modding on a
> variable length return field.
> eg.
> MOVE FUNCTION TRIM (MYFLD) (1:1) TO ..
>
> Note that TRIM can (AFAIKS) can return a zero
> field length.
> Yes, of course, one can test the field for spaces.
> The question is what should happen with the move ?


FDIS 2002, page 478, 14.8.24.3 [MOVE statement]
General rules, GR1, "The length of the data item
referenced by identifier-1 is evaluated only once,
immediately before the data is moved to the first of
the receiving operands. If identifier-1 is a zero-length
item, it is as if literal-1 were specified as the figurative
constant SPACE."

> Yes, Rick, I know that ref modding can return
> an exception code.


But, did you know that the use "ref modding" makes
me cringe and I prefer "reference modification",
because that is what the standard calls it. <g>



Roger While

2007-03-17, 6:55 pm


"Rick Smith" <ricksmith@mfi.net> schrieb im Newsbeitrag
news:12vogdvgo57b64c@corp.supernews.com...
>
> "Roger While" <simrw@sim-basis.de> wrote in message
> news:ethcp2$kce$00$1@news.t-online.com...
>
> FDIS 2002, page 478, 14.8.24.3 [MOVE statement]
> General rules, GR1, "The length of the data item
> referenced by identifier-1 is evaluated only once,
> immediately before the data is moved to the first of
> the receiving operands. If identifier-1 is a zero-length
> item, it is as if literal-1 were specified as the figurative
> constant SPACE."
>
>
> But, did you know that the use "ref modding" makes
> me cringe and I prefer "reference modification",
> because that is what the standard calls it. <g>
>
>

Ha,
then call things what they really are -
eg. FUNCTION LOCALE-UPPER-CASE
FUNCTION LOCALE-LOWER-CASE
FUNCTION TRIM-LEADING
FUNCTION TRIM-TRAILING
etc. (for more FUNCTIONS) instead of confusing all users.




Rick Smith

2007-03-17, 6:55 pm


"Roger While" <simrw@sim-basis.de> wrote in message
news:ethmp0$lqq$03$1@news.t-online.com...
>
> "Rick Smith" <ricksmith@mfi.net> schrieb im Newsbeitrag
> news:12vogdvgo57b64c@corp.supernews.com...
[snip][color=darkred]
> Ha,
> then call things what they really are -
> eg. FUNCTION LOCALE-UPPER-CASE
> FUNCTION LOCALE-LOWER-CASE
> FUNCTION TRIM-LEADING
> FUNCTION TRIM-TRAILING
> etc. (for more FUNCTIONS) instead of confusing all users.


Functions aren't called; they're activated. <g>

FDIS 2002, page 385, 14.5.2.1.1 Active state,
"An instance of a function is placed in an active state
when it is successfully activated and remains active
until the execution of a GOBACK or STOP statement
or an implicit or explicit function format of the EXIT
statement within this instance of this function."



William M. Klein

2007-03-19, 3:55 am

Roger,
What would you do when you reference modify ANY zero-length item, e.g.

01 Big.
05 Num1 Pic 9.
05 Tabl.
10 Elem occurs 0 to 9 times depending on Num
Pic X.
...
Move Zero to Num1
Move Tabl (1:) to Wherever


--
Bill Klein
wmklein <at> ix.netcom.com
"Roger While" <simrw@sim-basis.de> wrote in message
news:ethcp2$kce$00$1@news.t-online.com...
> Intersting, (alphanumeric) FUNCTION's can be ref-modded.
> OK. I can see the point of getting some
> subset of eg. CURRENT-DATE.
>
> Interesting is, however, using ref modding on a
> variable length return field.
> eg.
> MOVE FUNCTION TRIM (MYFLD) (1:1) TO ..
>
> Note that TRIM can (AFAIKS) can return a zero
> field length.
> Yes, of course, one can test the field for spaces.
> The question is what should happen with the move ?
> Yes, Rick, I know that ref modding can return
> an exception code.
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com