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


  • Subject: Re: Condition not working ?
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 11 May 1999 13:03:22 -0500

Hi...

I guess I'm missing the part where you set the data in the user
space to blanks?]  Is that in the RCRTUS program that you're calling
in here?

I'd recommend, rather than checking for blank data, that you read the
number of list entries out of the header thats placed in the user
space, then simply use a "DO" to loop from 1 - n.

This will eliminate the possibility of an endless loop, and wont
rely on that data in the user space to contain any specific data...
It also eliminates the need to initialize all of the data in the user
space to a specific value (saving time) and eliminates the need to do
something different when the data isnt found, this saves you an
IF statement, and simplifies your code

Granted, the performance difference will be negligible, but your code
will be stronger and easier to follow -- and wont loop forever]

Thats my 2 cents :)


JFinney@omnia.co.za wrote:
> Hi All,
> I have a unique problem in that I wrote a small pgm to simply copy
>  members
> of a source file to a folder.
> The loop where RECARR(X) eventually becomes blank and should then
>  leave
> does not seem to work.
> I ran it in debug and physically saw RECCARR(X) contained *blanks an
>  then
> watched it continue processing.
> Is there something inherently wrong with the logic which I can't see
>  or is
> there something else happening here?
> This is not the first time I have seen this happen ]
>
> DSPC_NAM          S             20    INZ('MBRLIST   QTEMP')
>      DFMT_NAM          S              8    INZ('MBRL0100')
>      DOVERRIDE         S             10    INZ('1')
>      DSTRPOS           S              9B 0 INZ(513)
>      DDTALEN           S              9B 0 INZ(10)
>      DRETCODE          S             30
>      DRECARR           S             10    DIM(9999)
>      DDB_FILE          S             20
>      DX                S              5  0
>      DTESTLEN          S              2  0
>
>      DCMDLEN           S             15  5
>      DCMD1             S             18    INZ('CPYTOPCD FROMFILE(')
>      DCMD2             S              8    INZ(') TOFLR(')
>      DCMD3             S             11    INZ(') FROMMBR(')
>      DCMD4             S              8    INZ(') TODOC(')
>      DCMD5             S             15    INZ(') REPLACE(*YES)')
>      DTODOC            S             13
>
>      DCOMMAND          S            110
>
>
>      C     *ENTRY        PLIST
>      C                   PARM                    FILENAME         10
>      C                   PARM                    LIBRARY          10
>      C                   PARM                    MEMBER           10
>      C                   PARM                    FOLDER           10
>
>      C     MBRLIST       PLIST
>      C                   PARM                    SPC_NAM
>      C                   PARM                    FMT_NAM
>      C                   PARM                    DB_FILE
>      C                   PARM                    MEMBER
>      C                   PARM                    OVERRIDE
>
>      C     RTVLIST       PLIST
>      C                   PARM                    SPC_NAM
>      C                   PARM                    STRPOS
>      C                   PARM                    DTALEN
>      C                   PARM                    RECARR(X)
>      C                   PARM                    RETCODE
>
>      C     QCMDLIST      PLIST
>      C                   PARM                    COMMAND
>      C                   PARM                    CMDLEN
>
>
>      C                   EVAL      DB_FILE = FILENAME + LIBRARY
>
>      C                   IF        MEMBER = '*ALL'
>      C                   CALL      'RCRTUS'
>      C                   PARM                    SPC_NAM
>      C                   CALL      'QUSLMBR'     MBRLIST
>      C                   ENDIF
>
>      C                   CLEAR                   X
>      C                   DOU       RECARR(X) = *BLANKS
>      C                   EVAL      X = X + 1
>      C                   CALL      'QUSRTVUS'    RTVLIST
>      C                   EVAL      STRPOS = STRPOS + 10
>      C                   ENDDO
>
>
>      C                   CLEAR                   X
>      C                   DOU       RECARR(X) = *BLANKS
>      C                   EVAL      X = X + 1
>      C                   CLEAR                   TESTLEN
>      C                   EVAL      TESTLEN = %LEN(%TRIM(RECARR(X)))
>
>      C                   IF        RECARR(X) = *BLANKS
>      C                   LEAVE
>      C                   ELSE
>
>      C                   CLEAR                   TODOC
>      C                   IF        TESTLEN > 8
>      C                   EVAL      TODOC = %SUBST(RECARR(X):1:8) + '
>      C                             + %SUBST(RECARR(X):9:2)
>      C                   ELSE
>      C                   EVAL      TODOC = RECARR(X)
>      C                   ENDIF
>
>      C                   EVAL      COMMAND = CMD1 + %TRIM(LIBRARY) +
>  '/'
>      C                             + %TRIM(FILENAME) + CMD2 +
>  %TRIM(FOLDER)
>      C                             + CMD3 + %TRIM(RECARR(X)) + CMD4
>      C                             + %TRIM(TODOC) + CMD5
>
>
>      C                   EVAL      CMDLEN = %LEN(%TRIM(COMMAND))
>      C                   CALL      'QCMDEXC'     QCMDLIST
>      C                   ENDIF
>      C                   ENDDO
>
>      C                   SETON
>  LR
>
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>  * *
> * This is the RPG/400 Discussion Mailing List]  To submit a new
>   *
> * message, send your mail to "RPG400-L@midrange.com".  To unsubscrib
>   *
> * from this list send email to MAJORDOMO@midrange.com and specify
>   *
> * 'unsubscribe RPG400-L' in the body of your message.  Questions
>  should *
> * be directed to the list owner / operator: david@midrange.com
>   *
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>  * *
>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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.