how to best handle multiple level breaks for amount totals using ILE

pts.
Tags:
Development
RPG
I'm having a hard time getting my ILE program to read a record from a file in consultant number, order type, order class sequence. It is possible a consultant may have 1 or many order types and needs to break & total some fields on each different order type, and of course break on a different consultant number and total fields for that consultant. Sample data: customer number order type order class 12345 RO 7 12346 BO 0 FR 1 FR 6 12350 RO 1 RO 3 BO 0 FR 0 This progrtam was originally a RPG and I converted it to ILE. Thanks for any help.......my boss is breathing down my neck *smile* Jinxmom

Answer Wiki

Thanks. We'll let you know when a new response is added.

Assuming your file is a keyed pf or lf by ConsNumber, OrderType, OrderClass…here’s some quick rpgle code.

You’ll need to add the finer details but this is a basic structure that doesn’t use the Logic cycle. (which personally I have no problem with)

C kEY3 kLIST
C kFLD cONS_nUM
C kFLD oRD_TYPE
C KFLD oRD_CLS

c kEY2 kLIST
C kFLD cONS_NUM
C KFLD ORD_TYPE

C KEY1 KLIST
C KFLD CONS_NUM

C READ RCDFMT
C DOW not %EOF

C WRITE DETAIL

C KEY3 READE RCDFMT
*
* PERFORM ORDER CLASS BREAK
C IF %EOF
C WRITE ORDCLSTOTAL
*
* POSITION TO NEXT ORDER CLASS FOR THIS CONS_NUMBER/ORDER TYPE
C KEY3 SETGT RCDFMT
C KEY2 READE RCDFMT
*
* PERFORM ORDERTYPE BREAK
C IF %EOF
C WRITE ORDTYPETOTAL
*
* POSITION TO NEXT ORDER TYPE FOR THIS CONSULTANT

C KEY2 SETGT RCDFMT
C KEY1 READE RCDFMT
*
* PERFORM CONSULTANT BREAK
C IF %EOF
C WRITE CONSTOTAL
*
* POSITION TO NEXT CONSULTANT
C KEY1 SETGT RCDFMT
C READ RCDFMT
C ENDIF

C ENDIF

C ENDIF

C ENDDO
*
* perform final totals
c write grandtotals
*
* end the program
C EVAL *INLR = *on

hope this helps
rex

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
  • Jallison
    Not sure what your shop standards are, but if you are allowed to use the RPG cycle, then you can still define an Input Primary record in ILE, then set up your standard Control Break fields just like RPG II. We are a mostly ILE shop, but do have programs that use the cycle for reports with substantial Control Breaks. You will obviously have to remove the Read statement and let the cycle do your reads for you - but if you're under the gun for time, the cycle is very good at handling control breaks
    0 pointsBadges:
    report
  • TomLiotta
    This progrtam was originally a RPG and I converted it to ILE. If it worked as RPG/400, it should work the same after conversion to ILE RPG. What is the actual problem? Did you convert it (with CVTRPGSRC), or did you rewrite it? 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