That was noted in my earlier reply with the option of using OPNQRYF for
record selection if needed.
Use RCVF to get the record
Use OpnQryF if record selection is needed (ugh!)
Substring out the date piece
Do the compare
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Wednesday, July 31, 2013 11:10 AM
To: Midrange Systems Technical Discussion
Subject: Re: output date field from a flat file into a variable
Good catch Chuck. I failed to notice the lack of a where clause.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: CRPence <CRPbottle@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx,
Date: 07/31/2013 02:07 PM
Subject: Re: output date field from a flat file into a variable
Sent by: midrange-l-bounces@xxxxxxxxxxxx
So instead of "I can get" as a statement, the question is "How can I
get"; i.e. consistent with what seemingly was attempted to be implied in
the "Subject:" line [but a /date field/ is not an option for a flat-file].
Because there is no embedded SQL for CL, and the WHERE-clause in the
SQL SELECT shown, why not just use the CL RCVF which is the CL interface
to the database? For example:
DCLF admadmrec /* flat file with same name for Fmt and Fld */
...
RCVF /* a /defined/ declaration for &var could eliminate CHGVAR */
chgvar &var %sst(&admadmrec 9 8)
...
There are other and probably better ways, but contained solely within
the CLP, that is quite simple and /fits/ within the language.
Of course given much fuller details about the overall scenario and
what is by-definition already established and unchanging, along with the
other /requirements/ [like those unchanging things are], some better
ideas might be able to be offered. As it is now, the reader has no idea
of the background and goals; e.g. how or why the flat-file is being
created and thus the reader can not suggest if that data might better be
stored in a data area or ???
Regards, Chuck
On 30 Jul 2013 16:58, A Paul wrote:
I am hoping there must be a way to get 1. by using SQL (as written
in my earlier email) in CL, that is what I am looking for...
<<SNIP>>
On Tue, Jul 30, 2013 at 5:07 PM, A Paul wrote:
1. I can get the date (&var) by using SQL given below
SELECT substr(admadmrec, 9, 8) from admfile
<<SNIP>>
On Tue, Jul 30, 2013 at 4:25 PM, A Paulwrote:
<<SNIP>>
I get the date from a flat file with the below SQL
SELECT substr(admadmrec, 9, 8) from admfile
the value is in format yyyymmdd.
How do you output this date into a variable (&VAR)
<<SNIP>>
As an Amazon Associate we earn from qualifying purchases.