|
On 1/18/21 5:31 AM, techie21 IT wrote:
I have two fields let's say fld1,fld2(date field) and having their
data types in CL program as Character but in RPG program they are as
numeric
I suggested a DS, with zoned and character fields superimposed over each
other.
On 1/19/21 9:56 AM, techie21 IT wrote:
Sorry i did not understand it could you please explain it with a
code example in my program?
Well, I don't have all of your code to patch, but suppose the CL program
has:
DCL VAR(&FLD1) TYPE(*CHAR) LEN(6)
DCL VAR(&FLD2) TYPE(*CHAR) LEN(8)
with those fields passed to the RPG program, hopefully containing valid
character representations of numbers. Then the RPG program could have:
D FLD1 DS
D FLD1A 1 6A
D FLD1Z 1 6S 0
D FLD2 DS
D FLD2A 1 8A
D FLD2Z 1 8S 0
. . .
ENTRY PLIST
PARM FLD1
PARM FLD2
and you could then check FLD1A and FLD2A to make sure they're valid
zoned decimal numbers, and if so, you would reference FLD1Z and FLD2Z
for their numeric values.
Or, if I remember right, there are some slick (relatively) new built-in
functions that can, fed a character variable containing a valid,
parseable representation of a number, return the number (in which case
your validation would just be a go/no-go check, and you could skip the
old-fashioned DS overlays.
--
JHHL
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
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.