× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Strange...when I created a simple DDS:

R WRKRECORD
DATEL L
TIMET T
STAMPX Z

my date field came out as X(10):

WRK-DATEL PIC X(10).
(Date field)
WRK-TIMET PIC X(8).
(Time field)
WRK-STAMPX PIC X(26).

Are you sure the definition is correct?

I was under the impression that you had to convert the PF date types
(T, Z and L) into pre-formatted date elements in order to use the
Add/Subract functions.

05 DATE-FLD1 format date '@Y-%m-%d'.

move function convert-date-time (WRK-DATEL date) to DATE-FLD1

But I confesss that we rarely use any of the date data-types in
our physical files so I could be way off base here...

Terry

-----Original Message-----
From: COBOL400-L [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Wednesday, September 07, 2016 12:15 PM
To: 'COBOL Programming on the IBM i (AS/400 and iSeries)'
Subject: [COBOL400-L] help! Any idea why this date function will not compile?

Does the add-duration function not work on database fields?

Why is the field: A0704-DTDUE-DT appearing in the memory map as AN (alpha) when the compiler KNOWS that it is a date data type? How can I get the compiler to recognize that the field is a date?

V7r1


Thanks!


Database field:

65 +000022 06 A0704-DTDUE-DT PIC X(8).
+000023* DUE DT
+000024* (Date field)



662 044400 move function ADD-DURATION
044500 (A0704-DTdue-dt of CSCDATEr days 5)
044600 to A0704-DTdue-dt of CSCDATEr


* 662 MSGID: LNC2767 SEVERITY: 30 SEQNBR: 044500
Message . . . . : Function argument 'A0704-DTDUE-DT OF CSCDATER' did
not have the correct type for function 'FUNCTION ADD-DURATION'.


*map on compile:

65 06 A0704-DTDUE-DT FS 00000019 8 AN





Here is a map of a date data type in WS:

499 05 WS-DATE WS 00000065 8 DT






Create Bound COBOL Program (CRTBNDCBL)

Type choices, press Enter.

Program . . . . . . . . . . . . > CMP704I Name, *PGMI
Library . . . . . . . . . . . > JSTONE Name, *CURL
Source file . . . . . . . . . . > S Name
Library . . . . . . . . . . . *LIBL Name, *LIBL
Source member . . . . . . . . . *PGM Name, *PGM
Source stream file . . . . . . .

Generation severity level . . . 30 0-30
Text 'description' . . . . . . . *SRCMBRTXT


Additional Parameters

Conversion options . . . . . . . > *DATETIME
+ for more values
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l.


Confidentiality Notice: The preceding e-mail message (including any attachments) contains information that may be confidential, protected by applicable legal privileges, or constitute non-public information. It is intended to be conveyed only to the designated recipient(s). If you are not an intended recipient of this message, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution or reproduction of this message by unintended recipients is not authorized and may be unlawful.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.