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



David,

A couple of minor things:

1. Don't bother initializing the output DS in the calling procedure - simply
initialize it in the called procedure - that reduces the amount of
'mainline' code. and when you do initialize it, simply use the CLEAR or
RESET op-codes, rather than individually moving blanks to the separate
subfields.

2. Don't bother with the leading 'I' or 'O' for the subfields - they're
qualified by the DS name anyway.

I like Charles' technique of passing a 'format' - either as a separate
parameter or as part of the MyProcInDS structure - maybe as the first
8-bytes of MyProcInDS:

* Data structure defining the input parameters.
D MyProcInDs DS QUALIFIED

D BASED (PtrDs)
D Format 8
D Parm1 10
D Parm2 2
...
// Calling procedure

MyProcIn.Format = 'IN000001';
MyProcIn.Parm1 = 'something';
MyProcIn.Parm2 = 'else';

Inside the procedure, you check MyProcIn.Format to determine what kind of
structure was passed and therefore what the parameters are. You could do the
same with MyProcOutDS as well, but it probably wouldn't be as useful.

Another option would be to simply pass a single 'input' data-structure and
to have the procedure return either a pointer to a data-structure or the
data-structure itself (as a string):

* Data structure defining the output parameters.
D MyProcOutDs DS QUALIFIED

D BASED (PtrDs)
D RtnCde N
D Format 8A
D Parm1 5A
D Parm2 5A

// Calling procedure

MyProcIn.Format = 'IN000001';
MyProcIn.Iparm1 = 'something';
MyProcIn.Iparm2 = 'else';

MyProcOut = MyProc( MyProcIn );
if MyProcOut.RtnCde = *off;
select;
when MyProcOut.Format = 'OUT00001';
Erreur = MyProcOut.Parm2 ;
RETURN *OFF ;
when MyProcOut.Format = 'OUT00002';
Erreur = MyProcOut.Parm1 ;
RETURN *OFF ;
other;
Erreur = 'ERROR' ;
RETURN *OFF ;
endsl;
ENDIF ;

That way, you can easily pass separate structure formats back from the
procedure.

Mind you, as Charles points out, maybe this is more work than you need for *
all* your procedures.

Rory

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.