What we did when we had some programmers that were quite anal about large 
/copy members that had a bunch of stuff they didn't use, was to bust it 
up.  Here's a simplistic example:

Original member  COPYMBR  (Not a real life example, just simplified!)
  D MyDate                 s           d
  D MyChar                 s         15a
Became
  D/copy qcpysrc,MyDate
  D/copy qcpysrc,MyChar
Now, if they wanted everything in COPYMBR they could just include
  D/copy qcpysrc,copymbr
and that would get both other members.  But if they just wanted one they 
could do just
  D/copy qcpysrc,MyDate


Now, let's take that to the next level.  Let's change all three members. 
Now we have

MYDATE
  D/define MYDATE
  D MyDate                 s           d
MYCHAR
  D/define MYCHAR
  D MyChar                 s         15a
COPYMBR
  D/if not defined(MYDATE)
  D/copy qcpysrc,MyDate
  D/endif
  D/if not defined(MYCHAR)
  D/copy qcpysrc,MyChar
  D/endif

Now, let's say we have a program called PGM.  At first they had a 
  D/copy qcpysrc,MyDate
Now, they wanted the whole COPYMBR so they added it, but didn't take out 
the first /copy so they have
  D/copy qcpysrc,MyDate
  D/copy qcpysrc,copymbr
It doesn't copy in MYDATE twice because of the /define.  Get it?


I do a LOT of api's.  API's traditionally use an error structure.  I have 
a member called ERRC0100
 /Define errc0100 
 * ERRC0100 - Error code data structure 
D ERRC0100        DS 
D  BytesProvided                10I 0 INZ(%len(errc0100))
D  BytesAvail                   10I 0 
D  ExceptionId                   7A 
D  Reserved1                     1A 
D  ExceptData                  250A 
D ERRC0100P       S                   LIKE(ERRC0100) 


Then one of my api members is called  QCLRDTAQ.  It looks like
 /Define qclrdtaq 
 * Clear data from a data queue. 
D qclrdtaq        PR                  EXTPGM('QCLRDTAQ') 
D  DataQue                      10A   CONST 
D  DataQueLib                   10A   CONST 
 * Optional Parameter Group 1 
D  KeyOrder                      2A   CONST OPTIONS(*NOPASS) 
D  KeyLength                     3P 0 CONST OPTIONS(*NOPASS) 
D  KeyData                     200A   CONST OPTIONS(*NOPASS:*VARSIZE)
D  ErrorCode                          OPTIONS(*NOPASS:*VARSIZE) 
D                                     LIKE(ERRC0100P) 
 
D qclrdtaqEr      ds                  likeds(errc0100) INZ(*LIKEDS) 
 
 /If not defined(errc0100) 
 /INCLUDE ROUTINES/QAPISRC,ERRC0100 
 /EndIf 

Rob Berendt

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.