Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

X 6.1.5.2.3 Storing Arithmetic Results That Involve Date Fields




X The following statements perform arithmetic, then store the result, or
X sending field, into one or more receiving fields:


X Note: In a MULTIPLY statement, only GIVING identifiers can be date
X fields. In a DIVIDE statement, only GIVING identifiers or the REMAINDER
X identifier can be date fields.


X Any windowed date fields that are operands of the arithmetic expression or
X statement are treated as if they were expanded before use, as described
X under "Semantics of Windowed Date Fields" in topic 5.3.6.1.


| If the sending field is a date field, then the receiving field must be a
| compatible date field. That is, both fields must have the same date
| format, except for the year part, which may be windowed or expanded.


| If the ON SIZE ERROR clause is not specified on the statement, the store
| operation follows the existing COBOL rules for the statement, and proceeds
| as if the receiving and sending fields (after any automatic expansion of
| windowed date field operands or result) were both non-dates.


X When the ON SIZE ERROR clause is specified, Table 19 shows how these
X statements store the value of a sending field in a receiving field, where
X either field may be a date field.


X Table 19uses the following terms to describe how the store is performed:


X Non-windowed

X The statement performs the store with no special date-sensitive
X size error processing, as described under "SIZE ERROR Phrases"
X in topic 6.1.8.4.


X Windowed...


X ...with non-date sending field

X The non-date sending field is treated as a windowed date field
X compatible with the windowed date receiving field, but with the
X year part representing the number of years since 1900. (This
X representation is similar to a windowed date field with a base
X year of 1900, except that the year part is not limited to a
X positive number of at most 2 digits.) The store proceeds as if
X this assumed year part of the sending field were expanded by
X adding 1900 to it.


X ...with date sending field

X The store proceeds as if all windowed date field operands had
X been expanded as necessary, so that the sending field is a
X compatible expanded date field.


X Size error processing: For both kinds of sending field, if the
X assumed or actual year part of the sending field falls within
X the century window, then the sending field is stored in the
X receiving field after removing the century component of the year
X part. That is, the low-order or rightmost 2 digits of the
X expanded year part are retained, and the high-order or leftmost
X 2 digits are discarded.


X If the year part does not fall within the century window, then
X the receiving field is unmodified, and the size error imperative
X statement is executed when any remaining arithmetic operations
X are complete.


X For example:


 X                    77  DUE-DATE PICTURE 9(5) DATE FORMAT YYXXX.
 X                    77  IN-DATE  PICTURE 9(8) DATE FORMAT YYYYXXX VALUE 1995001.

X .
X .
X .
X COMPUTE DUE-DATE = IN-DATE + 10000 X ON SIZE ERROR imperative-statement X END-COMPUTE


X The sending field is an expanded date field representing January
X 1, 2005. Assuming that 2005 falls within the century window,
X the value stored in DUE-DATE is 05001--the sending value of
X 2005001 without the century component 20.


| >_Host_>


| Size error processing and trigger values: If the DATEPROC(TRIG) compiler
| option is in effect, and the sending field contains a trigger value
| (either zero or all nines) the size error imperative statement is
| executed, and the result is not stored in the receiving field.



| A non-date is considered to have a trigger value of all nines if it has a
| nine in every digit position of its assumed date format. Thus, for a
| receiving date format of YYXXX, the non-date value 99,999 is a trigger,
| but the values 9,999 and 999,999 are not, although the larger value of
| 999,999 will cause a size error anyway. <_Host_<


RevisionX  Table 19. Storing Arithmetic Results Involving Date Fields When ON     
RevisionX            SIZE ERROR is Specified                                      
RevisionX                      
                     
RevisionX  Receiving Field     
RevisionX                    Sending Field                  
RevisionX  Non-date                 RevisionX  Date field             
RevisionX  Non-date             RevisionX  Non-windowed             RevisionX  Not allowed            
RevisionX  Windowed date field  RevisionX  Windowed                 RevisionX  Windowed               
RevisionX  Expanded date field  RevisionX  Non-windowed             RevisionX  Non-windowed           




Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.