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




H OPTION(*NODEBUGIO: *SRCSTMT) CVTOPT(*DATETIME:*VARCHAR)
D InEmp              S             25A   Varying
D WkEmp           S             25

Remove the CVTOPT(*VARCHAR).

D                 DS
D String                  1    255A   VARYING
D  Length               1      4B 0
D  Data                   3    255

This data structure is wrong, and makes no sense at all. Positions 3 & 4 in your definition are both part of the character data AND part of the length! A VARYING field only uses 2 bytes for the length, so it makes no sense to declare positions 1-4 as the length -- that's 4 bytes.

Similarly, the B data type is wrong. Though, it might not matter with a 255 character long field. There's absolutely no advantage to declaring this field as "B". Use the U data type, it's faster, and more correct for this application.

Futhermore, you could have garbage in the "data" field, since the system won't necessarily fill the unused portion with blanks.

I'm not sure why you're using a data structure at all. Why not simply do the following:

  C                   EVAL      WkEmp = InEmp

Let the system convert it from VARYING to fixed-length. Why reinvent the wheel when it's built into RPG?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.