×
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.
On 17 Aug 2013 08:39, Vernon Hamberg wrote:
I've a zoned 8,0 that is being MOVEd to a packed 6,0. I want to
convert this to free form.
I can think of putting the zoned 8,0 into a data structure with a
zoned 6,0 overlaying the last 6 positions, then use an assignment
statement.
In the following, I wanted to use CNVDAT instead of CNVDT8.
That can work with fields from a file, didn't work so far, so I
will use an assignment of CNVDT8 = CNVDAT for now.
* Allow "MOVE" of 8-digit ot 6-digiy
D DATE8TO6 DS
D CNVDT8 8s 0
D CNVDT6 6S 0 overlay(DATE8TO6 : 3)
Then CNVDT6 should have the value I want - this is 8-digit dates to
6-digit in YMD format.
So basically this proposes the above declarative in combination with
the following two assignment statements to replace the MOVE?:
CNVDT8 = CNVDAT ; // copy field data to Date8to6 storage
P6_TARGET = CNVDT6 ; // set 6P00 variable from 6S00 data overlay
Is there a better way? <<SNIP>>
Probably not /better/ generally, but to effect a replacement of the
one MOVE statement with just one assignment statement, with at least the
additional cost of the potential confusion for reviewers just as with
the above proposed additional storage, perhaps using redefined storage
instead...
The proposed extra run-time assignment CNVDT8=CNVDAT being used to
copy the value into some automatic storage in preparation for another
assignment P6_TARGET=CNVDT6 could be replaced with a similar
compile-time declaration and the assignment of an address [in automatic
storage] also in compile-time, in combination with just one assignment
using a reference to the original data [i.e. not a prior copy] using
based storage:
D p6_target S 6P00
D*
D basdt@ S * inz(%addr(cnvdat))
D base8to6 DS based(basdt@)
D basdt8 like(cnvdat)
D basdt6 6S00 overlay(basdt8 : 3)
The old code in fixed-form:
c move cnvdat p6_target
The new code in free-form:
p6_target = basdt6 ; // set 6P00 variable from 6S00 data overlay
As an Amazon Associate we earn from qualifying purchases.