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



From: "DeLong, Eric"
I'd probably use a dou (1=1) / enddo block, with enddo replacing the
tag line and a leave replacing the goto.


I too have missed a plain DO ... ENDDO to separate a code block from
other areas within code, just so I could LEAVE the section of code. But
rather than DOU (1=1) ugliness, I created a procedure similar to RSPEC
to document intent/requirement within my source.

If @rdocc('code Block for xxxx ' :
'@rdocc always returns True') ;

And this @rdocc comment can take 1 to 4 parms. Inefficient perhaps, but
it documents the code nicely.

// @rdocc = comment
P @rdocc B

D @rdocc PI N

D Text1 256 const

D Text2 256 options( *NOPASS ) const

D Text3 256 options( *NOPASS ) const

D Text4 256 options( *NOPASS ) const

C Return *On

P @rdocc E


It has a sister procedure " @rdocj " that throws the comment out to the
joblog using QMHSNDPM, which helps me debug/document the program flow.
It is the same prototype as @rdocc, so I can scan/replace @rdocj before
releasing to production if I want. But I usually just leave it as
@rdocj.

// @rdocj = debug msg & pgm intent for RPG-DOCS
P @rdocj B
D @rdocj PI like(ReturnVar)
D Text1 256 const
D Text2 256 options( *NOPASS ) const
D Text3 256 options( *NOPASS ) const
D Text4 256 options( *NOPASS ) const
D
D ReturnVar S N
D
D QMHSNDPM PR EXTPGM('QMHSNDPM')
D MsgID 7A const
D MsgFile 20A const
D MsgData 32767A const options(*varsize)
D MsgDtaLen 10I 0 const
D MsgType 10A const
D StackEntry 10A const
D StackEntry 10A const
D StackCount 10I 0 const
D MsgKey 4A
D ErrorCode 32767A options(*varsize)

D ErrorCode DS
D BytesProv 10I 0 inz(0)
D BytesAvail 10I 0 inz(0)
D Msg S 200A
D MsgKey S 4A
/free
Monitor ;
/IF DEFINED(@rdocj)
MSG = Text1 ;
If %PARMS >= 2 AND %ADDR(Text2) <> *NULL ;
MSG = %TrimR( Msg ) + ' ' + Text2 ;
Endif ;
If %PARMS >= 3 AND %ADDR(Text3) <> *NULL ;
MSG = %TrimR( Msg ) + ' ' + Text3 ;
Endif ;
If %PARMS >= 4 AND %ADDR(Text4) <> *NULL ;
If %PARMS >= 4 AND %ADDR(Text4) <> *NULL ;
MSG = %TrimR( Msg ) + ' ' + Text4 ;
Endif ;

QMHSNDPM( 'CPF9897': 'QCPFMSG *LIBL': Msg
: %len( %trimr(Msg) )
: '*DIAG': '*': 0: MsgKey: ErrorCode );
/ENDIF
return *On ;
On-Error ;
return *Off;
EndMon ;
/end-free
P @rdocj E


But I have not missed the GOTO AT ALL !! ;O)


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.