AS/400 RPGLE

335 pts.
Tags:
AS/400
RPGLE
0001.00 DBXLATER1         pr            50
0002.00 Dinpstr                         50a
0003.00 PBXLATER1         b
0004.00 DBXLATER1         pi            50
0005.00 Dinpstr                         50a
0006.00 Doutstr           s             50a
0007.00 Dwork             s              1a
0008.00 Dpos              s              3s 0 inz(0)
0009.00 Di                s              3s 0 inz(0)
0010.00 Dlower            c                  'abcdefghijklmnopqrstuvwxyz'
0011.00 Dupper            c 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
0012.00 C                   eval      outstr = %xlate(upper:lower:inpstr) 0013.00 C                   eval      work = %xlate(lower:upper:%subst(inpstr:1
0014.00 C                   eval      outstr = work + %trim(%subst(inpstr:2))
0015.00  *
0016.00 C                   dou       i >= %len(inpstr)
0017.00 C                   eval      i = i + 1
0018.00  *
0019.00 C                   if        i >= %len(inpstr)
0020.00 C                   leave
0021.00 C                   endif
0022.00  *
0023.00 C                   eval      pos = %scan(' ':inpstr:i)
0024.00 C                   eval      work = %xlate(lower:upper: 0025.00 C                             %subst(inpstr:pos+1:1))
0026.00 C                   eval      outstr = %replace(work:outstr:pos+1:1)
0027.00 C                   eval      i = pos
0028.00 C                   enddo
0029.00 C                   return    outstr
0030.00 C                   eval      *inlr = *on
0031.00 PBXLATER1         e

another module bx1

0001.00 Dinstr            s             50a   inz('myself dinesh')
0002.00 Doustr            s             50a
0003.00 DBXLATER1         pr            50
0004.00 Dinpstr                         50a
0005.00 C                   eval      oustr = BXLATER1(instr)
0006.00 C     oustr         dsply
0007.00 C                   eval      *inlr = *on 


I converted the above module bxlater1 into service program and I converted the bx1 into a module and I binded the module and the service program into a program object to run and the program bx1 created in the library perfectly.but when I am calling the program ,the program is being pushed into infinite loop and when seeing the CPU percentage for the job it is taking 50.0.please let me know the reasons why it is going into infinite loop and what are the precautions to be taken to get rid of this problem. Thanks in advance.

Software/Hardware used:
iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    Perhaps this will help

    The   %len(inpstr) will always be 40 (the field length)

    Perhaps you wanted to use the %len(%trim(inpstr) )

    which would be the length of the populated string.                    
                           
                           

    50,205 pointsBadges:
    report
  • TomLiotta

    Also, having [eval i = i + 1] and [eval i = pos] both inside the loop is just begging for trouble. That'd be especially true if [eval pos = %scan(' ':inpstr:i)] returns a (0) result.

    Tom

    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following