|
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 and 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 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 mailing list archive is Copyright 1997-2025 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.