× 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.



>>You still can.  CL is an ILE language.

>But you could not easily handle the diff data
>types of diff data areas. Call the module to
>chg a char dtara, then call it again to chg a
>dec(11,2) dtaara, then a logical, ...

CRTDTAARA DTAARA(BUCK/NUMB) TYPE(*DEC) LEN(10 0) TEXT('Numeric data area  -
testing')
CRTDTAARA DTAARA(BUCK/CHAR) TYPE(*CHAR) LEN(50) TEXT('Character data area -
testing')
CRTDTAARA DTAARA(BUCK/LOGL) TYPE(*LGL) TEXT('Logical data area - testing')


/* ugly code alert */
=== CHGDA
pgm (&dtaara &inp_value)

dcl &dtaara    *char  20
dcl &inp_value *char 128

dcl &dname     *char  10
dcl &dlibr     *char  10
dcl &wrk_char  *char   8
dcl &wrk_numb  *dec ( 15 5)

chgvar &dname %sst(&dtaara 01 10)
chgvar &dlibr %sst(&dtaara 11 10)

chgdtaara &dlibr/&dname +
  value(&inp_value)
monmsg cpf1019 exec(do)   /* invalid format - must be decimal */
  chgvar &wrk_char %sst(&inp_value 01 08)
  call chgda2 (&wrk_char &wrk_numb)
  chgdtaara &dlibr/&dname +
    value(&wrk_numb)
  enddo

endpgm

=== CHGDA2
pgm (&numb_inp &char_out)

dcl &numb_inp  *dec (15 5)
dcl &numb_out  *dec (15 5)

chgvar &numb_out &numb_inp

endpgm

===
call chgda ('NUMB      BUCK      ' 123)
call chgda ('CHAR      BUCK      ' 'Character data


                                                            ')
call chgda ('LOGL      BUCK      ' '1


                                                            ')

Note that I needed to supply the "extra" spaces because I declared the input
variable to be 128 bytes.
This is ugly, but I would argue that it is easy.  The only work is that the
caller must supply the data in the proper format, but that's what you'd have
to do with an API, too.

Buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.